88 *
99 * @providesModule LayoutAnimation
1010 * @flow
11+ * @format
1112 */
1213'use strict' ;
1314
14- var UIManager = require ( 'UIManager' ) ;
15+ const PropTypes = require ( 'prop-types' ) ;
16+ const UIManager = require ( 'UIManager' ) ;
1517
16- var keyMirror = require ( 'fbjs/lib/keyMirror' ) ;
18+ const keyMirror = require ( 'fbjs/lib/keyMirror' ) ;
1719
18- var { checkPropTypes, PropTypes } = require ( 'react' ) ;
20+ const { checkPropTypes} = PropTypes ;
1921
20- var TypesEnum = {
22+ const TypesEnum = {
2123 spring : true ,
2224 linear : true ,
2325 easeInEaseOut : true ,
2426 easeIn : true ,
2527 easeOut : true ,
2628 keyboard : true ,
2729} ;
28- var Types = keyMirror ( TypesEnum ) ;
30+ const Types = keyMirror ( TypesEnum ) ;
2931
30- var PropertiesEnum = {
32+ const PropertiesEnum = {
3133 opacity : true ,
3234 scaleXY : true ,
3335} ;
34- var Properties = keyMirror ( PropertiesEnum ) ;
36+ const Properties = keyMirror ( PropertiesEnum ) ;
3537
36- var animType = PropTypes . shape ( {
38+ const animType = PropTypes . shape ( {
3739 duration : PropTypes . number ,
3840 delay : PropTypes . number ,
3941 springDamping : PropTypes . number ,
4042 initialVelocity : PropTypes . number ,
41- type : PropTypes . oneOf (
42- Object . keys ( Types )
43- ) . isRequired ,
44- property : PropTypes . oneOf ( // Only applies to create/delete
45- Object . keys ( Properties )
43+ type : PropTypes . oneOf ( Object . keys ( Types ) ) . isRequired ,
44+ property : PropTypes . oneOf (
45+ // Only applies to create/delete
46+ Object . keys ( Properties ) ,
4647 ) ,
4748} ) ;
4849
@@ -53,9 +54,9 @@ type Anim = {
5354 initialVelocity ?: number ,
5455 type ?: $Enum < typeof TypesEnum > ,
5556 property ?: $Enum < typeof PropertiesEnum > ,
56- }
57+ } ;
5758
58- var configType = PropTypes . shape ( {
59+ const configType = PropTypes . shape ( {
5960 duration : PropTypes . number . isRequired ,
6061 create : animType ,
6162 update : animType ,
@@ -67,7 +68,7 @@ type Config = {
6768 create ?: Anim ,
6869 update ?: Anim ,
6970 delete ?: Anim ,
70- }
71+ } ;
7172
7273function checkConfig ( config : Config , location : string , name : string ) {
7374 checkPropTypes ( { config : configType } , { config} , location , name ) ;
@@ -78,7 +79,11 @@ function configureNext(config: Config, onAnimationDidEnd?: Function) {
7879 checkConfig ( config , 'config' , 'LayoutAnimation.configureNext' ) ;
7980 }
8081 UIManager . configureNextLayoutAnimation (
81- config , onAnimationDidEnd || function ( ) { } , function ( ) { /* unused */ }
82+ config ,
83+ onAnimationDidEnd || function ( ) { } ,
84+ function ( ) {
85+ /* unused */
86+ } ,
8287 ) ;
8388}
8489
@@ -99,13 +104,9 @@ function create(duration: number, type, creationProp): Config {
99104 } ;
100105}
101106
102- var Presets = {
103- easeInEaseOut : create (
104- 300 , Types . easeInEaseOut , Properties . opacity
105- ) ,
106- linear : create (
107- 500 , Types . linear , Properties . opacity
108- ) ,
107+ const Presets = {
108+ easeInEaseOut : create ( 300 , Types . easeInEaseOut , Properties . opacity ) ,
109+ linear : create ( 500 , Types . linear , Properties . opacity ) ,
109110 spring : {
110111 duration : 700 ,
111112 create : {
@@ -133,7 +134,7 @@ var Presets = {
133134 *
134135 * UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
135136 */
136- var LayoutAnimation = {
137+ const LayoutAnimation = {
137138 /**
138139 * Schedules an animation to happen on the next layout.
139140 *
@@ -157,15 +158,9 @@ var LayoutAnimation = {
157158 Properties,
158159 checkConfig,
159160 Presets,
160- easeInEaseOut : configureNext . bind (
161- null , Presets . easeInEaseOut
162- ) ,
163- linear : configureNext . bind (
164- null , Presets . linear
165- ) ,
166- spring : configureNext . bind (
167- null , Presets . spring
168- ) ,
161+ easeInEaseOut : configureNext . bind ( null , Presets . easeInEaseOut ) ,
162+ linear : configureNext . bind ( null , Presets . linear ) ,
163+ spring : configureNext . bind ( null , Presets . spring ) ,
169164} ;
170165
171166module . exports = LayoutAnimation ;
0 commit comments