Skip to content

Commit 26e8870

Browse files
nabatifacebook-github-bot
authored andcommitted
Add AnimatedInterpolation as possible type for toValue (#27558)
Summary: AnimatedInterpolation should be a valid type to pass to `toValue` according to the documentation. https://facebook.github.io/react-native/docs/animations#tracking-dynamic-values ## Changelog [General] [Fixed] - Add AnimationInterpolation as possible type for toValue Pull Request resolved: #27558 Test Plan: `yarn flow` works without errors. Differential Revision: D19296804 Pulled By: cpojer fbshipit-source-id: 7f09c762308c40f1eede5834fadf1837114aa397
1 parent d126507 commit 26e8870

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Libraries/Animated/src/animations/SpringAnimation.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
const AnimatedValue = require('../nodes/AnimatedValue');
1414
const AnimatedValueXY = require('../nodes/AnimatedValueXY');
15+
const AnimatedInterpolation = require('../nodes/AnimatedInterpolation');
1516
const Animation = require('./Animation');
1617
const SpringConfig = require('../SpringConfig');
1718

@@ -30,7 +31,8 @@ export type SpringAnimationConfig = AnimationConfig & {
3031
y: number,
3132
...
3233
}
33-
| AnimatedValueXY,
34+
| AnimatedValueXY
35+
| AnimatedInterpolation,
3436
overshootClamping?: boolean,
3537
restDisplacementThreshold?: number,
3638
restSpeedThreshold?: number,
@@ -53,7 +55,7 @@ export type SpringAnimationConfig = AnimationConfig & {
5355
};
5456

5557
export type SpringAnimationConfigSingle = AnimationConfig & {
56-
toValue: number | AnimatedValue,
58+
toValue: number | AnimatedValue | AnimatedInterpolation,
5759
overshootClamping?: boolean,
5860
restDisplacementThreshold?: number,
5961
restSpeedThreshold?: number,

Libraries/Animated/src/animations/TimingAnimation.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
const AnimatedValue = require('../nodes/AnimatedValue');
1414
const AnimatedValueXY = require('../nodes/AnimatedValueXY');
15+
const AnimatedInterpolation = require('../nodes/AnimatedInterpolation');
1516
const Animation = require('./Animation');
1617

1718
const {shouldUseNativeDriver} = require('../NativeAnimatedHelper');
@@ -27,15 +28,16 @@ export type TimingAnimationConfig = AnimationConfig & {
2728
y: number,
2829
...
2930
}
30-
| AnimatedValueXY,
31+
| AnimatedValueXY
32+
| AnimatedInterpolation,
3133
easing?: (value: number) => number,
3234
duration?: number,
3335
delay?: number,
3436
...
3537
};
3638

3739
export type TimingAnimationConfigSingle = AnimationConfig & {
38-
toValue: number | AnimatedValue,
40+
toValue: number | AnimatedValue | AnimatedInterpolation,
3941
easing?: (value: number) => number,
4042
duration?: number,
4143
delay?: number,

0 commit comments

Comments
 (0)