您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

react-native+0.72.9.patch 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. diff --git a/node_modules/react-native/React/CoreModules/RCTTiming.mm b/node_modules/react-native/React/CoreModules/RCTTiming.mm
  2. index e4f7e15..6f05fb3 100644
  3. --- a/node_modules/react-native/React/CoreModules/RCTTiming.mm
  4. +++ b/node_modules/react-native/React/CoreModules/RCTTiming.mm
  5. @@ -127,13 +127,16 @@ RCT_EXPORT_MODULE()
  6. {
  7. _paused = YES;
  8. _timers = [NSMutableDictionary new];
  9. - _inBackground = NO;
  10. - RCTExecuteOnMainQueue(^{
  11. - if (!self->_inBackground && [RCTSharedApplication() applicationState] == UIApplicationStateBackground) {
  12. - [self appDidMoveToBackground];
  13. - }
  14. +
  15. + __block BOOL initialInBackground;
  16. + dispatch_sync(dispatch_get_main_queue(), ^{
  17. + initialInBackground
  18. + = [UIApplication sharedApplication].applicationState == UIApplicationStateBackground
  19. + || [UIDevice currentDevice].proximityState;
  20. });
  21. + _inBackground = initialInBackground;
  22. +
  23. for (NSString *name in @[
  24. UIApplicationWillResignActiveNotification,
  25. UIApplicationDidEnterBackgroundNotification,
  26. @@ -151,6 +154,11 @@ RCT_EXPORT_MODULE()
  27. name:name
  28. object:nil];
  29. }
  30. +
  31. + [[NSNotificationCenter defaultCenter] addObserver:self
  32. + selector:@selector(proximityChanged)
  33. + name:UIDeviceProximityStateDidChangeNotification
  34. + object:nil];
  35. }
  36. - (void)dealloc
  37. @@ -187,6 +195,16 @@ RCT_EXPORT_MODULE()
  38. [self startTimers];
  39. }
  40. +- (void)proximityChanged
  41. +{
  42. + BOOL isClose = [UIDevice currentDevice].proximityState;
  43. + if (isClose) {
  44. + [self appDidMoveToBackground];
  45. + } else {
  46. + [self appDidMoveToForeground];
  47. + }
  48. +}
  49. +
  50. - (void)stopTimers
  51. {
  52. if (_inBackground) {