Skip to content

Commit

Permalink
【iOS】Fix timer background state when App is launched from background (#…
Browse files Browse the repository at this point in the history
…39347)

Summary:
Fixes #38711

## Changelog:

[IOS] [FIXED] - Fix timer background state when App is launched from background

Pull Request resolved: #39347

Test Plan: Please see #38711

Reviewed By: cipolleschi

Differential Revision: D49101979

Pulled By: dmytrorykun

fbshipit-source-id: e25b182539f39e4465fa40e51288d88c68967b31
  • Loading branch information
zhongwuzw authored and facebook-github-bot committed Sep 11, 2023
1 parent 0e150d0 commit a4ea737
Showing 1 changed file with 5 additions and 0 deletions.
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;
RCTExecuteOnMainQueue(^{
if (!self->_inBackground && [RCTSharedApplication() applicationState] == UIApplicationStateBackground) {
[self appDidMoveToBackground];
}
});

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

0 comments on commit a4ea737

Please sign in to comment.