A fork of React Native's `<Text/> component that supports Reanimated Shared Values as text!
npm install react-native-animateable-textA fork of React Native's component that supports Reanimated Shared Values as text!
| Animateable Text Version | RN Version | Old Arch | New Arch (Fabric) |
|---|---|---|---|
| ^0.17.0 | ^0.81.5 | ✅ | ✅ |
| ^0.16.0 | ^0.79.0 | ✅ | ✅ |
| ^0.15.0 | ^0.77.0 | ✅ | ✅ |
| ^0.14.2 | ^0.76.0 | ✅ | ✅ |
| ^0.13.0 | ^0.75.0 | ✅ | 🛑 |
| ^0.12.0 | ^0.74.0 | ✅ | 🛑 |
| ^0.11.0 | ^0.71.7 | ✅ | 🛑 |
| ^0.10.0 | ^0.68 | ✅ | 🛑 |
| ^0.9.1 | ^0.67 | ✅ | 🛑 |
| ^0.8.0 | ^0.66 | ✅ | 🛑 |
| ^0.7.0 | ^0.65 | ✅ | 🛑 |
| ^0.6.0 | ^0.64 | ✅ | 🛑 |
| ^0.5.9 | ^0.63 | ✅ | 🛑 |
First make sure you have reanimated already installed and linked from here then run
``sh`
yarn add react-native-animateable-text
then for Expo managed projects you need to prebuild your project, and for ReactNative bare projects you should run
`sh`
npx pod-install
> Note about Reanimated 2: The library does not work with Alpha 9 until RC1. Make sure to update to RC2 or later!
Use it the same as a component, except instead of passing the text as a child node, pass it using the text props.
`tsx
import AnimateableText from 'react-native-animateable-text';
const Example: React.FC = () => {
const reanimatedText = useSharedValue('World');
const animatedProps = useAnimatedProps(() => {
return {
text: reanimatedText.value,
};
});
return (
// all other
/>;
};
`
We want to animate numbers based on gestures as fast as possible, for example for charts displaying financial data. Updating native state is too slow and not feasible for a smooth experience. Using createAnimatedComponent doesn't allow you to animate the text since the children of Text are separate nodes rather than just props.
The best way so far has been to use the component from react-native-redash, which allows you to render a string from a Reanimated Text node. However, under the hood, it uses a and animates it's value` prop.
This naturally comes with a few edge cases, for example:

TextInput, you need to add more styles and spacing to make it align with the default Text styles. (Behavior in screenshot happens only on Android)
selectable (Android), dataDetectorType or onTextLayout.
See the contributing guide to learn how to contribute to the repository and the development workflow.
Written by Jonny Burger for our needs at Axelra.
Thanks to Axelra for sponsoring my time to turn this into an open source project!
We are a Swiss Agency specializing in React Native, caring even about the smallest of details.
MIT