Skip to content

Commit

Permalink
Native Animated - Override __makeNative in AnimatedInterpolation
Browse files Browse the repository at this point in the history
Summary:
Fixes the error `Trying to update interpolation node that has not been
attached to the parent` in android which occurs when using multiple
Animated.Values along with interpolation and an animation is run before
another one that uses interpolation. On ios, no error is thrown in such
case but the animation also doesn't work as expected.

You can check the snack code here which works properly without
useNativeDriver: true. But fails on android and skips the first stage
of animation on ios.
  https://snack.expo.io/HyD3zdjSZ

**Test Plan**
The animations worked properly after the __makeNative override made
the parent node native as well.

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes facebook#15077

Differential Revision: D5449066

Pulled By: shergin

fbshipit-source-id: 2f0b6ea712a0ab12c1c545514a3686a9a6aeebed
  • Loading branch information
syaau authored and facebook-github-bot committed Jul 19, 2017
1 parent af48b48 commit 1afee0b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Libraries/Animated/src/AnimatedImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,11 @@ class AnimatedInterpolation extends AnimatedWithChildren {
this._interpolation = Interpolation.create(config);
}

__makeNative() {
this._parent.__makeNative();
super.__makeNative();
}

__getValue(): number | string {
var parentValue: number = this._parent.__getValue();
invariant(
Expand Down

0 comments on commit 1afee0b

Please sign in to comment.