From 0aa7e5b5d4e427f9d3aa320f74b5a1adc56629ea Mon Sep 17 00:00:00 2001 From: Andrei Shikov Date: Tue, 27 Apr 2021 03:58:38 -0700 Subject: [PATCH] Back out "Assign batch number to only batched animated instructions" Summary: This change broke some animations on non-Fabric surfaces due to inconsistent batching of animation operations. Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D28013968 fbshipit-source-id: 2f65c799dbe00168f1e756ef0af60206df5a8fcc --- .../com/facebook/react/animated/NativeAnimatedModule.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java index 9d6f4299db2..dd7a0c1b2f3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java @@ -118,7 +118,6 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec private boolean mBatchingControlledByJS = false; // TODO T71377544: delete private volatile long mCurrentFrameNumber; // TODO T71377544: delete private volatile long mCurrentBatchNumber; - private volatile boolean mIsInBatch = false; private boolean mInitializedForFabric = false; private boolean mInitializedForNonFabric = false; @@ -174,7 +173,7 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec } private void addOperation(UIThreadOperation operation) { - operation.setBatchNumber(mIsInBatch ? mCurrentBatchNumber : -1); + operation.setBatchNumber(mCurrentBatchNumber); mOperations.add(operation); } @@ -184,7 +183,7 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec } private void addPreOperation(UIThreadOperation operation) { - operation.setBatchNumber(mIsInBatch ? mCurrentBatchNumber : -1); + operation.setBatchNumber(mCurrentBatchNumber); mPreOperations.add(operation); } @@ -427,14 +426,12 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec @Override public void startOperationBatch() { mBatchingControlledByJS = true; - mIsInBatch = true; mCurrentBatchNumber++; } @Override public void finishOperationBatch() { mBatchingControlledByJS = true; - mIsInBatch = false; mCurrentBatchNumber++; }