rendom
rendom

Reputation: 3715

React Native LayoutAnimation custom presets

We have predefined presets like this.

LayoutAnimation.configureNext(LayoutAnimation.Presets.linear);

But I did not found a way to use my custom presets for example with linear type and 0.1s speed.

Upvotes: 4

Views: 2513

Answers (1)

cseelus
cseelus

Reputation: 1679

You can use it like this:

LayoutAnimation.configureNext(CustomAnimation)

with

var CustomAnimation = {
  duration: 400,
  create: {
    type: LayoutAnimation.Types.spring,
    property: LayoutAnimation.Properties.scaleXY,
    springDamping: 0.7
  },
  update: {
    type: LayoutAnimation.Types.spring,
    springDamping: 0.7
  }
}

Upvotes: 7

Related Questions