Skip to content

Commit 71caf2c

Browse files
rozelefacebook-github-bot
authored andcommitted
Fix cross-over issue with animatedShouldUseSingleOp and animatedShouldSignalBatch (#51459)
Summary: Pull Request resolved: #51459 When using `animatedShouldSignalBatch` in combination with `animatedShouldUseSingleOp`, we were seeing an issue where the queue is not flushed deterministically. It would be flushed in an ad-hoc manner by `createAnimatedPropsHook.js`, but this was only if a mount happened to occur in the same frame. Adding a deterministic queue flush mechanism to the logic handling `animatedShouldUseSingleOp` appears to resolve the issue. ## Changelog [Internal] Reviewed By: javache Differential Revision: D75002657 fbshipit-source-id: 51f50af0f22becf152da15a720ba70dfc158cdbf
1 parent a703d4c commit 71caf2c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/react-native/src/private/animated/NativeAnimatedHelper.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ function createNativeOperations(): $NonMaybeType<typeof NativeAnimatedModule> {
9797
// is possible because # arguments is fixed for each operation. For more
9898
// details, see `NativeAnimatedModule.queueAndExecuteBatchedOperations`.
9999
singleOpQueue.push(operationID, ...args);
100+
if (shouldSignalBatch) {
101+
clearImmediate(flushQueueImmediate);
102+
flushQueueImmediate = setImmediate(API.flushQueue);
103+
}
100104
};
101105
}
102106
} else {

0 commit comments

Comments
 (0)