[RN] Fix iOS lockups / resprings

Apparently iOS doesn't like dangling background tasks very much, so update the
background timers plugin with a version which fixes this.

https://github.com/ocetnik/react-native-background-timer/pull/38

Also accomodate for the API changes upstream.

Credits to @lyubomir for finding the needle in the haystack.
This commit is contained in:
Saúl Ibarra Corretgé 2017-07-04 14:50:44 +02:00 committed by Lyubo Marinov
parent 66eac19058
commit 4e4a9012c2
2 changed files with 9 additions and 5 deletions

View File

@ -47,7 +47,7 @@
"react-dom": "15.4.2",
"react-i18next": "4.1.0",
"react-native": "0.42.3",
"react-native-background-timer": "1.0.2",
"react-native-background-timer": "saghul/react-native-background-timer#ios-end-task",
"react-native-immersive": "0.0.5",
"react-native-keep-awake": "2.0.4",
"react-native-locale-detector": "1.0.1",

View File

@ -372,9 +372,13 @@ function _visitNode(node, callback) {
// Required by:
// - lib-jitsi-meet
// - Strophe
global.clearTimeout = window.clearTimeout = BackgroundTimer.clearTimeout;
global.clearInterval = window.clearInterval = BackgroundTimer.clearInterval;
global.setInterval = window.setInterval = BackgroundTimer.setInterval;
global.setTimeout = window.setTimeout = BackgroundTimer.setTimeout;
global.clearTimeout = window.clearTimeout
= BackgroundTimer.clearTimeout.bind(BackgroundTimer);
global.clearInterval = window.clearInterval
= BackgroundTimer.clearInterval.bind(BackgroundTimer);
global.setInterval = window.setInterval
= BackgroundTimer.setInterval.bind(BackgroundTimer);
global.setTimeout = window.setTimeout
= BackgroundTimer.setTimeout.bind(BackgroundTimer);
})(global || window || this); // eslint-disable-line no-invalid-this