Note that the code you put is going to be executed only once. We currently have no way of telling if your code changes and so it will only be run in componentDidMount. If you wish for your reanimated nodes to be updated when the component updates, you can update the key property of the Animated.Code component, which will effectively unmount old and mount new versions of it in the React tree.
Actual behavior
The inside code of <Animated.Code> is always executed when render runs.
Description
The inside code of
<Animated.Code>
is always executed whenrender
runs. This happens in version 1.5 and above. (doesn't happen in version 1.4)Please let me know if my code has some problems or there are any effective workarounds.
Screenshots
Steps To Reproduce
Run this example Expo app on iOS or Android and drag the shape. https://github.com/gaishimo/rn-gesture-with-renimated/
Expected behavior
The inside code of
<Animated.Code>
should be executed only once.https://github.com/software-mansion/react-native-reanimated/blob/9ab83d8f601c0280580e1a47794aa20d32e45f0b/docs/pages/09.code.md
Actual behavior
The inside code of
<Animated.Code>
is always executed whenrender
runs.Snack or minimal code example
https://github.com/gaishimo/rn-gesture-with-reanimated/blob/master/App.tsx#L74-L98
Package versions