diff --git a/node_modules/react-native/React/CoreModules/RCTTiming.mm b/node_modules/react-native/React/CoreModules/RCTTiming.mm index 70f0543..d43a4be 100644 --- a/node_modules/react-native/React/CoreModules/RCTTiming.mm +++ b/node_modules/react-native/React/CoreModules/RCTTiming.mm @@ -146,6 +146,11 @@ - (void)setup name:name object:nil]; } + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(proximityChanged) + name:UIDeviceProximityStateDidChangeNotification + object:nil]; } - (void)dealloc @@ -182,6 +187,16 @@ - (void)appDidMoveToForeground [self startTimers]; } +- (void)proximityChanged +{ + BOOL isClose = [UIDevice currentDevice].proximityState; + if (isClose) { + [self appDidMoveToBackground]; + } else { + [self appDidMoveToForeground]; + } +} + - (void)stopTimers { if (_inBackground) {