the react native timer that can run in iOS app background state
npm install --save react-native-inback-timer-ios
- it's a timer can run in background state
- support ios only
- provide the same API with javascript (setTimeout, setInterval, clear) etc.
- you need link library react-native-inback-timer-ios (don't know linking ? scan here first)
- import react-native-inback-timer-ios in your container
import BGTimer from 'react-native-inback-timer-ios';
- start your timer
let timerID = BGTimer.setInterval(() => {
// do something..
});
}, 1000);
// ...
BGTimer.clear(timerID);
or
let timerID = BGTimer.setTimeout((data) => {
// time out!
}, 9000);