LayoutAnimation
Automatically animates views to their new positions when the next layout happens.
A common way to use this API is to call it before calling setState
.
Note that in order to get this to work on Android you need to set the following flags via UIManager
:
UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
Methods
Properties
Reference
Methods
configureNext()
static configureNext(config, onAnimationDidEnd?)
Schedules an animation to happen on the next layout.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
config | object | Yes | See config parameters below. |
onAnimationDidEnd | function | No | Called when the animation finished. Only supported on iOS. |
config
duration
in millisecondscreate
, config for animating in new views (seeAnim
type)update
, config for animating views that have been updated (seeAnim
type)
create()
static create(duration, type, creationProp)
Helper for creating a config for configureNext
.
Properties
Types
An enumerate of animation types to be used in create
method.
Types |
---|
spring |
linear |
easeInEaseOut |
easeIn |
easeOut |
keyboard |
Properties
An enumerate of object property to be animated, used in create
method.
Properties |
---|
opacity |
scaleX |
scaleY |
scaleXY |
Presets
A set of predefined animation config.
Presets | Value |
---|---|
easeInEaseOut | create(300, 'easeInEaseOut', 'opacity') |
linear | create(500, 'linear', 'opacity') |
spring | { duration: 700, create: { type: 'linear', property: 'opacity' }, update: { type: 'spring', springDamping: 0.4 }, delete: { type: 'linear', property: 'opacity' } } |
easeInEaseOut
Shortcut to bind configureNext()
methods with Presets.easeInEaseOut
.
linear
Shortcut to bind configureNext()
methods with Presets.linear
.
spring
Shortcut to bind configureNext()
methods with Presets.spring
.