Fix cross-over issue with animatedShouldUseSingleOp and animatedShouldSignalBatch (#51459)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Eric Rozell
2025-05-19 13:49:27 -07:00
committed by Facebook GitHub Bot
parent a703d4cfc1
commit 71caf2c557
@@ -97,6 +97,10 @@ function createNativeOperations(): $NonMaybeType<typeof NativeAnimatedModule> {
// is possible because # arguments is fixed for each operation. For more
// details, see `NativeAnimatedModule.queueAndExecuteBatchedOperations`.
singleOpQueue.push(operationID, ...args);
if (shouldSignalBatch) {
clearImmediate(flushQueueImmediate);
flushQueueImmediate = setImmediate(API.flushQueue);
}
};
}
} else {