diff --git a/Libraries/Animated/NativeAnimatedHelper.js b/Libraries/Animated/NativeAnimatedHelper.js index e97a10d262e..3588e197b51 100644 --- a/Libraries/Animated/NativeAnimatedHelper.js +++ b/Libraries/Animated/NativeAnimatedHelper.js @@ -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 => {