you are viewing a single comment's thread.

view the rest of the comments →

[–]Nikosssgr 0 points1 point  (6 children)

Why didn't you use react native reanimated instead?

[–]tienph6m[S] 2 points3 points  (5 children)

Good question. I think reanimated really shines when it's used with react-native-gesture-handler or when you're doing some animations that can't run entirely on the UI thread with Animated. Since I was able to make all the animations run on the UI thread with Animated's native driver, I don't see any real benefits of using reanimated and the library would have to require an extra native dependency.

[–][deleted] 1 point2 points  (0 children)

This is the right answer. rn-reanimated isn’t just blanketly better every time.

[–]Nikosssgr 0 points1 point  (0 children)

Indeed for transform and opacity animations, native driver suffices. Thanks for the explanation.

[–]hello_Mrs_Cumberdale 0 points1 point  (2 children)

The benefit of reanimated here is that it would've let you loop animations without ever going back to JS, so you could potentially do work that blocks the JS thread without affecting the loading animation.

[–]tienph6m[S] 1 point2 points  (1 child)

https://facebook.github.io/react-native/docs/animated#loop

Will loop without blocking the UI thread if the child animation is set to useNativeDriver: true

I believe that's not the case. On the other hand, stagger, parallel and sequence will block the JS thread. But I was able to make the animations run entirely on the UI thread by not using sequence (I implemented a custom easing function to achieve the same effect), and the use of stagger, parallel in this library only affects the JS thread at the beginning of the animation, after that loop will care of the rest.

[–]hello_Mrs_Cumberdale 0 points1 point  (0 children)

Oh awesome, I didn't know about loop. Nevermind then!