diff --git a/Libraries/Animated/NativeAnimatedHelper.js b/Libraries/Animated/NativeAnimatedHelper.js index 6e3ff5506c8..04e426e2e58 100644 --- a/Libraries/Animated/NativeAnimatedHelper.js +++ b/Libraries/Animated/NativeAnimatedHelper.js @@ -150,9 +150,6 @@ const API = { invariant(NativeAnimatedModule, 'Native animated module is not available'); flushQueueTimeout = null; - if (Platform.OS === 'android') { - NativeAnimatedModule.startOperationBatch?.(); - } if (useSingleOpBatching) { // Set up event listener for callbacks if it's not set up if ( @@ -168,13 +165,13 @@ const API = { NativeAnimatedModule.queueAndExecuteBatchedOperations?.(singleOpQueue); singleOpQueue.length = 0; } else { + Platform.OS === 'android' && NativeAnimatedModule.startOperationBatch?.(); for (let q = 0, l = queue.length; q < l; q++) { queue[q](); } queue.length = 0; - } - if (Platform.OS === 'android') { - NativeAnimatedModule.finishOperationBatch?.(); + Platform.OS === 'android' && + NativeAnimatedModule.finishOperationBatch?.(); } }, queueOperation: , Fn: (...Args) => void>( diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java index ca2e85ac26e..663634c2859 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java @@ -126,6 +126,8 @@ public class MountItemDispatcher { mInDispatch = false; } + // We call didDispatchMountItems regardless of whether we actually dispatched anything, since + // NativeAnimatedModule relies on this for executing any animations that may have been scheduled mItemDispatchListener.didDispatchMountItems(); // Decide if we want to try reentering