Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

【iOS】Fix timer background state when App is launched from background #39347

Closed
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/react-native/React/CoreModules/RCTTiming.mm
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ - (void)setup
_paused = YES;
_timers = [NSMutableDictionary new];
_inBackground = NO;
dispatch_async(dispatch_get_main_queue(), ^{
if (!self->_inBackground && [UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
[self appDidMoveToBackground];
}
});

for (NSString *name in @[
UIApplicationWillResignActiveNotification,
Expand Down