mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-02 23:05:01 +08:00
Implement NativeAnimated offsets on Android
Summary: This diff implements NativeAnimation offsets on Android. Running the examples should show no change; however, calling `setOffset()` should offset the final value for any value node by that amount. This brings Android up to date with JS and iOS animation APIs. Closes https://github.com/facebook/react-native/pull/10680 Differential Revision: D4119609 fbshipit-source-id: 96dccdf25f67c64c6787fd9ac762ec841cefc46a
This commit is contained in:
committed by
Facebook Github Bot
parent
68c61203ac
commit
8e81644f64
@@ -136,6 +136,25 @@ import javax.annotation.Nullable;
|
||||
mUpdatedNodes.add(node);
|
||||
}
|
||||
|
||||
public void setAnimatedNodeOffset(int tag, double offset) {
|
||||
AnimatedNode node = mAnimatedNodes.get(tag);
|
||||
if (node == null || !(node instanceof ValueAnimatedNode)) {
|
||||
throw new JSApplicationIllegalArgumentException("Animated node with tag " + tag +
|
||||
" does not exists or is not a 'value' node");
|
||||
}
|
||||
((ValueAnimatedNode) node).mOffset = offset;
|
||||
mUpdatedNodes.add(node);
|
||||
}
|
||||
|
||||
public void flattenAnimatedNodeOffset(int tag) {
|
||||
AnimatedNode node = mAnimatedNodes.get(tag);
|
||||
if (node == null || !(node instanceof ValueAnimatedNode)) {
|
||||
throw new JSApplicationIllegalArgumentException("Animated node with tag " + tag +
|
||||
" does not exists or is not a 'value' node");
|
||||
}
|
||||
((ValueAnimatedNode) node).flattenOffset();
|
||||
}
|
||||
|
||||
public void startAnimatingNode(
|
||||
int animationId,
|
||||
int animatedNodeTag,
|
||||
|
||||
Reference in New Issue
Block a user