Support Interpolation of strings when using native driver in Animated, fix Expected node to be marked as "native", optimize AnimatedNode creation and connections (#18187)

Summary:
Allow interpolation of strings with useNativeDriver. This allows animating much more of react-native-svg. This PR adds support for native animation of lengths with units, path data, colors etc. Plus, fixing the redundantly created nodes and (and thus, previously incorrect) connection of native animated nodes, improving performance.

Docs will need to change, specifying that string interpolation works with the native driver as well.

[GENERAL] [Added] Add support for native driven string interpolation in Animated
[GENERAL] Fix exception: Expected node to be marked as "native"
[GENERAL] Fix connection of AnimatedNodes and creation of redundant AnimatedNodes
Pull Request resolved: https://github.com/facebook/react-native/pull/18187

Differential Revision: D14597147

Pulled By: cpojer

fbshipit-source-id: 82a948a95419236be7931a8cc4ff72f41e477e9c
This commit is contained in:
Mikael Sand
2019-03-26 09:33:25 -07:00
committed by Facebook Github Bot
parent 81a702b426
commit 5e4a5892b9
13 changed files with 240 additions and 18 deletions
@@ -16,6 +16,7 @@ import javax.annotation.Nullable;
* library.
*/
/*package*/ class ValueAnimatedNode extends AnimatedNode {
/*package*/ Object mAnimatedObject = null;
/*package*/ double mValue = Double.NaN;
/*package*/ double mOffset = 0;
private @Nullable AnimatedNodeValueListener mValueListener;
@@ -33,6 +34,10 @@ import javax.annotation.Nullable;
return mOffset + mValue;
}
public Object getAnimatedObject() {
return mAnimatedObject;
}
public void flattenOffset() {
mValue += mOffset;
mOffset = 0;