From 493cb359660e9fd9c69121f5a40a32908738db5c Mon Sep 17 00:00:00 2001 From: Bill Fisher Date: Wed, 9 Sep 2015 23:52:41 -0700 Subject: [PATCH] Fix flow typing of TimingAnimationConfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: @​public Make the flow type of TimingAnimationConfig and TimingAnimation the same as SpringAnimationConfig and SpringAnimation. This is a more accurate flow type as both are multiplexed through maybeVectorAnim(). Reviewed By: @sahrens Differential Revision: D2410166 --- Libraries/Animated/Animated.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Libraries/Animated/Animated.js b/Libraries/Animated/Animated.js index 1a357f033..b4d814eff 100644 --- a/Libraries/Animated/Animated.js +++ b/Libraries/Animated/Animated.js @@ -131,7 +131,14 @@ function _flush(rootNode: AnimatedValue): void { } type TimingAnimationConfig = { - toValue: number; + toValue: number | AnimatedValue | {x: number, y: number} | AnimatedValueXY; + easing?: (value: number) => number; + duration?: number; + delay?: number; +}; + +type TimingAnimationConfigSingle = { + toValue: number | AnimatedValue; easing?: (value: number) => number; duration?: number; delay?: number; @@ -142,7 +149,7 @@ var easeInOut = Easing.inOut(Easing.ease); class TimingAnimation extends Animation { _startTime: number; _fromValue: number; - _toValue: number; + _toValue: any; _duration: number; _delay: number; _easing: (value: number) => number; @@ -151,7 +158,7 @@ class TimingAnimation extends Animation { _timeout: any; constructor( - config: TimingAnimationConfig, + config: TimingAnimationConfigSingle, ) { super(); this._toValue = config.toValue;