0

I've been using reanimated to implement some nice 60fps animations in our apps at work.

I'm on 0.60.3 with react Native, so I use the fast refresh functionality.

I have an issue where if I write anything that includes reanimated and therefore is executed on the UI thread and not the js, reloading doesn't work, whether it's fast-refresh or a full reload of the app. A full, stopping the app and building it again makes it work though.

Here's what happens:

Let's say I'm trying to animate the translateY of an Animated.View. I write the code and it works. If I make a change to anything in the code (even just saving the code again without changing anything) the animation completely stops working. If I swap my Animated.View to a normal View, save, reload, change it back to Animated.View, save reload again it works again until I make changes to reanimated code. Normal JS changes work though.

It's doing the same for both iOS and Android, whether I'm in the simulator or on device.

I'm trying to figure out what could be causing this. I'm assuming what's happening is metro updates the JS code but everything "over the bridge" doesn't get updated.

But who is it to blame for this? Is it metro, node, react Native or something else? Any response is appreciated, it's driving me crazy.

Hardik Virani
  • 1,687
  • 7
  • 23
  • 36
airick94
  • 23
  • 4
  • can put your code in expo? – Yoel Jan 11 '20 at 18:37
  • I tried running a nbew expo app with some reanimated code and it seems to work there. It doesn't really help me to figure out what's going on, as it's not an option to use expo for us. – airick94 Jan 15 '20 at 12:12
  • Did you ever manage to resolve this? I am seeing a similar issue. – Martha Feb 21 '20 at 11:53
  • 1
    Yes I have. Turned out to be an issue with how react deals with components in memory, losing instances when it re-renders the components. The solution was using react's useMemo hook, so the instance of the component is persisted through renders. That's as much as I understand at least, hope that helps – airick94 Feb 22 '20 at 12:30

0 Answers0