You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that you can't pass interpolated animations to AnimatedValue constructor
const LIMIT = 100; // or some other value
const pan2 = new Animated.ValueXY({
x: this.state.pan.x.interpolate({
inputRange: [-LIMIT, LIMIT],
outputRange: [-LIMIT, LIMIT],
extrapolate: 'clamp',
}),
y: this.state.pan.y.interpolate({
inputRange: [-LIMIT, LIMIT],
outputRange: [-LIMIT, LIMIT],
extrapolate: 'clamp',
}),
});
because of the following invariant in AnimatedImplementation.js
invariant(
value.x instanceof AnimatedValue &&
value.y instanceof AnimatedValue,
'AnimatedValueXY must be initalized with an object of numbers or ' +
'AnimatedValues.'
);
Funny thing is that commenting the invariant solves the problem and everything works as expected.
The problem is that AnimatedInterpolation is not an instance of AnimatedValue, but an instance of AnimatedWithChildren instance of Animated.
Theoretically, the solution would be to change the invariant to Animated.
ProductPains helps the community prioritize the most important issues thanks to its voting feature.
It is easy to use - just login with GitHub.
Also, if this issue is a bug, please consider sending a PR with a fix.
We're a small team and rely on the community for bug fixes of issues that don't affect fb apps.
Activity
charpeni commentedon Nov 14, 2016
@facebook-github-bot label Icebox
charpeni commentedon Nov 14, 2016
Hi there! This issue is being closed because it has been inactive for a while.
But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/animatedvaluexy-winterpolate
ProductPains helps the community prioritize the most important issues thanks to its voting feature.
It is easy to use - just login with GitHub.
Also, if this issue is a bug, please consider sending a PR with a fix.
We're a small team and rely on the community for bug fixes of issues that don't affect fb apps.
charpeni commentedon Nov 14, 2016
@facebook-github-bot close
facebook-github-bot commentedon Nov 14, 2016
@charpeni tells me to close this issue. If you think it should still be opened let us know why.