O'Reilly logo

React Native - Building Mobile Apps with JavaScript by Vladimir Novick

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The preset system under the hood

For simple animations, we can pass the existing presets, but sometimes we would want to create our own animation configuration, starting from opacity to spring damping or other properties. It can be configured using the LayoutAnimation.create function. So, the pattern will be as follows:

const customAnimationConfig = LayoutAnimation.create(config)LayoutAnimation.configureNext(customAnimationConfig)

Now, let's see what exactly we can pass inside config. For that, let's take a look at how linear and easeInEaseOut presets are configured in our source code:

  • easeInEaseOut configuration is done in the following way (that's how it's done in the source code):
    create(  300, Types.easeInEaseOut, Properties.opacity

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required