fix: avoid calling Timing.deleteTimer for setImmediate and requestIdleCallback (#26113)

Summary:
Fix a simple error where `types[index]` was being accessed after it was cleared, instead of before.

## Changelog

[iOS] [Fixed] - never call deleteTimer for setImmediate and requestIdleCallback
Pull Request resolved: https://github.com/facebook/react-native/pull/26113

Test Plan: None

Differential Revision: D17314489

Pulled By: cpojer

fbshipit-source-id: 74715f0f7cc2d5cee3b97a67313c5e96e9d6c555
This commit is contained in:
Alec Larson 2019-09-11 06:02:50 -07:00 коммит произвёл Facebook Github Bot
Родитель 796b3a1f88
Коммит 4fc3e7ae71
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -218,8 +218,8 @@ function _freeCallback(timerID: number) {
const index = timerIDs.indexOf(timerID);
// See corresponding comment in `callTimers` for reasoning behind this
if (index !== -1) {
_clearIndex(index);
const type = types[index];
_clearIndex(index);
if (type !== 'setImmediate' && type !== 'requestIdleCallback') {
deleteTimer(timerID);
}