1111 */
1212'use strict' ;
1313
14- var NativeAnimatedModule = require ( 'NativeModules' ) . NativeAnimatedModule ;
14+ const NativeAnimatedModule = require ( 'NativeModules' ) . NativeAnimatedModule ;
15+ const NativeEventEmitter = require ( 'NativeEventEmitter' ) ;
1516
16- var invariant = require ( 'fbjs/lib/invariant' ) ;
17+ const invariant = require ( 'fbjs/lib/invariant' ) ;
1718
18- var __nativeAnimatedNodeTagCount = 1 ; /* used for animated nodes */
19- var __nativeAnimationIdCount = 1 ; /* used for started animations */
19+ let __nativeAnimatedNodeTagCount = 1 ; /* used for animated nodes */
20+ let __nativeAnimationIdCount = 1 ; /* used for started animations */
2021
2122type EndResult = { finished : bool } ;
2223type EndCallback = ( result : EndResult ) => void ;
2324
25+ const nativeEventEmitter = new NativeEventEmitter ( NativeAnimatedModule ) ;
26+
2427/**
25- * Simple wrappers around NativeANimatedModule to provide flow and autocmplete support for
28+ * Simple wrappers around NativeAnimatedModule to provide flow and autocmplete support for
2629 * the native module methods
2730 */
28- var API = {
31+ const API = {
2932 createAnimatedNode : function ( tag : number , config : Object ) : void {
3033 assertNativeAnimatedModule ( ) ;
3134 NativeAnimatedModule . createAnimatedNode ( tag , config ) ;
@@ -79,7 +82,7 @@ var API = {
7982 * to be updated through the shadow view hierarchy (all non-layout properties). This list is limited
8083 * to the properties that will perform best when animated off the JS thread.
8184 */
82- var PROPS_WHITELIST = {
85+ const PROPS_WHITELIST = {
8386 style : {
8487 opacity : true ,
8588 transform : true ,
@@ -91,7 +94,7 @@ var PROPS_WHITELIST = {
9194 } ,
9295} ;
9396
94- var TRANSFORM_WHITELIST = {
97+ const TRANSFORM_WHITELIST = {
9598 translateX : true ,
9699 translateY : true ,
97100 scale : true ,
@@ -152,11 +155,6 @@ function assertNativeAnimatedModule(): void {
152155 invariant ( NativeAnimatedModule , 'Native animated module is not available' ) ;
153156}
154157
155- // TODO: remove this when iOS supports native listeners.
156- function supportsNativeListener ( ) : bool {
157- return ! ! NativeAnimatedModule . startListeningToAnimatedNodeValue ;
158- }
159-
160158module . exports = {
161159 API ,
162160 validateProps,
@@ -166,5 +164,5 @@ module.exports = {
166164 generateNewNodeTag,
167165 generateNewAnimationId,
168166 assertNativeAnimatedModule,
169- supportsNativeListener ,
167+ nativeEventEmitter ,
170168} ;
0 commit comments