We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 84b75f6 commit dcd8511Copy full SHA for dcd8511
React/CoreModules/RCTTiming.mm
@@ -148,6 +148,11 @@ - (void)setup
148
name:name
149
object:nil];
150
}
151
+
152
+ [[NSNotificationCenter defaultCenter] addObserver:self
153
+ selector:@selector(deviceProximityStateDidChange)
154
+ name:UIDeviceProximityStateDidChangeNotification
155
+ object:nil];
156
157
158
- (void)dealloc
@@ -184,6 +189,15 @@ - (void)appDidMoveToForeground
184
189
[self startTimers];
185
190
186
191
192
+- (void)deviceProximityStateDidChange
193
+{
194
+ if ([[UIDevice currentDevice] proximityState]) {
195
+ [self appDidMoveToBackground];
196
+ } else {
197
+ [self appDidMoveToForeground];
198
+ }
199
+}
200
187
201
- (void)stopTimers
188
202
{
203
if (_inBackground) {
0 commit comments