React Native Animated Text

On Cyber Monday I sprang for William Candillon’s course on animation with React Native. I love his style. And I like how beautiful his examples are. However, it took me a few minutes to understand that he’s basing all his work on two libraries, Redash, and Reanimated. These tools are super powerful, and I’m off to a strong start building lovely app animations, but I ran into a couple of problems while getting started.

  1. TypeError: global.__reanimatedWorkletInit is not a function

I got this error the first time I tried to use Redash. I had installed both it and reanimated, imported a hook, and tried to use it. But the app immediately crashed. I resolved it by importing reanimated at the top of the file:

import "react-native-reanimated";
import ...
  1. Animated string values would cause a rerender in the UI.

With useDerivedValue I transitioned a string into existence by animating its length. However, when I passed the Animation.SharedValue<string> to a Retext component and tested it out in my app, there was no animation.

Thanks to an answer this github issue I fixed that problem by whitelisting text as an animatable prop:

Animated.addWhitelistedNativeProps({ text: true });

After adding that line to the top of the file, my views updated without a problem as the text animated.



, ,




Leave a Reply