1.

How does React Native achieve native performance for some of its animations?

Answer»

REACT native provide Animated library out of the box which is designed to make ANIMATION fluid, maintainable and easy to build. It also provides a SIMPLE start/stop method to control time-based animations. Certain animation types, like Animation.timing and Animation.spring, can be serialized and sent across the asynchronous bridge before they are executed. This allows the runtime to defer the actual drawing of the animation entirely to the native side, instead of trying to send positional values across the bridge as each frame is rendered. 

This does not work with animations that are not computable ahead of time. We can COMBINE multiple animations and can chain different animation steps to produce complex animations. By setting useNativeDriver: true in the animated config, we send all the animation information to the native, before starting the animation. This allows native code to perform the animation on UI thread without having to go through the bridge on every frame.



Discussion

No Comment Found