From 5a0012efd38cddda25aea37cc0486d4a6bd78428 Mon Sep 17 00:00:00 2001 From: Connor McEwen Date: Thu, 9 Feb 2017 14:32:32 -0800 Subject: [PATCH] Export Animated.Interpolation Summary: Flow was complaining about an interpolated value I created in a class constructor, and I realized there was no way to properly import the `AnimatedInterpolation` class type. This allows for using `Animated.Interpolation` as a type to match `Animated.Value` Closes https://github.com/facebook/react-native/pull/9360 Differential Revision: D4538770 Pulled By: lacker fbshipit-source-id: 49da2374f2d73ad3d667dafaa6338b77b9aec8a8 --- Libraries/Animated/src/AnimatedImplementation.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Libraries/Animated/src/AnimatedImplementation.js b/Libraries/Animated/src/AnimatedImplementation.js index 8ab2117b5..2497428c5 100644 --- a/Libraries/Animated/src/AnimatedImplementation.js +++ b/Libraries/Animated/src/AnimatedImplementation.js @@ -1090,9 +1090,6 @@ class AnimatedInterpolation extends AnimatedWithChildren { typeof parentValue === 'number', 'Cannot interpolate an input which is not a number.' ); - /* $FlowFixMe(>=0.36.0 site=react_native_fb,react_native_oss) Flow error - * detected during the deploy of Flow v0.36.0. To see the error, remove - * this comment and run Flow */ return this._interpolation(parentValue); } @@ -1109,7 +1106,7 @@ class AnimatedInterpolation extends AnimatedWithChildren { super.__detach(); } - __transformDataType(range) { + __transformDataType(range: Array) { // Change the string array type to number array // So we can reuse the same logic in iOS and Android platform return range.map(function (value) { @@ -2377,6 +2374,10 @@ module.exports = { * 2D value class for driving 2D animations, such as pan gestures. */ ValueXY: AnimatedValueXY, + /** + * exported to use the Interpolation type in flow + */ + Interpolation: AnimatedInterpolation, /** * Animates a value from an initial velocity to zero based on a decay