Skip to content
Permalink
Browse files
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
  • Loading branch information
nabati authored and facebook-github-bot committed Jan 7, 2020
1 parent d126507 commit 26e8870
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
@@ -12,6 +12,7 @@

const AnimatedValue = require('../nodes/AnimatedValue');
const AnimatedValueXY = require('../nodes/AnimatedValueXY');
const AnimatedInterpolation = require('../nodes/AnimatedInterpolation');
const Animation = require('./Animation');
const SpringConfig = require('../SpringConfig');

@@ -30,7 +31,8 @@ export type SpringAnimationConfig = AnimationConfig & {
y: number,
...
}
| AnimatedValueXY,
| AnimatedValueXY
| AnimatedInterpolation,
overshootClamping?: boolean,
restDisplacementThreshold?: number,
restSpeedThreshold?: number,
@@ -53,7 +55,7 @@ export type SpringAnimationConfig = AnimationConfig & {
};

export type SpringAnimationConfigSingle = AnimationConfig & {
toValue: number | AnimatedValue,
toValue: number | AnimatedValue | AnimatedInterpolation,
overshootClamping?: boolean,
restDisplacementThreshold?: number,
restSpeedThreshold?: number,
@@ -12,6 +12,7 @@

const AnimatedValue = require('../nodes/AnimatedValue');
const AnimatedValueXY = require('../nodes/AnimatedValueXY');
const AnimatedInterpolation = require('../nodes/AnimatedInterpolation');
const Animation = require('./Animation');

const {shouldUseNativeDriver} = require('../NativeAnimatedHelper');
@@ -27,15 +28,16 @@ export type TimingAnimationConfig = AnimationConfig & {
y: number,
...
}
| AnimatedValueXY,
| AnimatedValueXY
| AnimatedInterpolation,
easing?: (value: number) => number,
duration?: number,
delay?: number,
...
};

export type TimingAnimationConfigSingle = AnimationConfig & {
toValue: number | AnimatedValue,
toValue: number | AnimatedValue | AnimatedInterpolation,
easing?: (value: number) => number,
duration?: number,
delay?: number,

0 comments on commit 26e8870

Please sign in to comment.