mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Check queue size before starting Animated batch
Summary: Small win: if the queue is empty we shouldn't start/stop the batch. Changelog: [Internal] Reviewed By: rshest Differential Revision: D36298399 fbshipit-source-id: b43c07994ba28b4c890fe52af4e81c265a3b8ac7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2c5a966054
commit
55ee8ce0c4
@@ -65,16 +65,18 @@ const API = {
|
||||
},
|
||||
disableQueue: function (): void {
|
||||
invariant(NativeAnimatedModule, 'Native animated module is not available');
|
||||
|
||||
if (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();
|
||||
const queueLength = queue.length;
|
||||
if (queueLength > 0) {
|
||||
if (Platform.OS === 'android') {
|
||||
NativeAnimatedModule.startOperationBatch();
|
||||
}
|
||||
for (let i = 0; i < queueLength; i++) {
|
||||
queue[i]();
|
||||
}
|
||||
queue.length = 0;
|
||||
if (Platform.OS === 'android') {
|
||||
NativeAnimatedModule.finishOperationBatch();
|
||||
}
|
||||
}
|
||||
},
|
||||
queueOperation: (fn: () => void): void => {
|
||||
|
||||
Reference in New Issue
Block a user