Skip to content

Commit 7e64636

Browse files
javachefacebook-github-bot
authored andcommitted
Avoid start/finishOperationBatch when using singleOp Animated experiment
Summary: Splitting these changes of from D36482630, which is a minor improvement to the singleOp experiment. Since we call start/finish already on the native side, we don't need to repeat it from JS. Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D36541700 fbshipit-source-id: 7d61669710faca3153be557fb2d214011eda87c5
1 parent 08ebc1c commit 7e64636

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Libraries/Animated/NativeAnimatedHelper.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ const API = {
150150
invariant(NativeAnimatedModule, 'Native animated module is not available');
151151
flushQueueTimeout = null;
152152

153-
if (Platform.OS === 'android') {
154-
NativeAnimatedModule.startOperationBatch?.();
155-
}
156153
if (useSingleOpBatching) {
157154
// Set up event listener for callbacks if it's not set up
158155
if (
@@ -168,13 +165,13 @@ const API = {
168165
NativeAnimatedModule.queueAndExecuteBatchedOperations?.(singleOpQueue);
169166
singleOpQueue.length = 0;
170167
} else {
168+
Platform.OS === 'android' && NativeAnimatedModule.startOperationBatch?.();
171169
for (let q = 0, l = queue.length; q < l; q++) {
172170
queue[q]();
173171
}
174172
queue.length = 0;
175-
}
176-
if (Platform.OS === 'android') {
177-
NativeAnimatedModule.finishOperationBatch?.();
173+
Platform.OS === 'android' &&
174+
NativeAnimatedModule.finishOperationBatch?.();
178175
}
179176
},
180177
queueOperation: <Args: $ReadOnlyArray<mixed>, Fn: (...Args) => void>(

ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java

+2
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ public boolean tryDispatchMountItems() {
126126
mInDispatch = false;
127127
}
128128

129+
// We call didDispatchMountItems regardless of whether we actually dispatched anything, since
130+
// NativeAnimatedModule relies on this for executing any animations that may have been scheduled
129131
mItemDispatchListener.didDispatchMountItems();
130132

131133
// Decide if we want to try reentering

0 commit comments

Comments
 (0)