mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove invalidate observer instead of re-adding observer in DeviceInfo module (#43737)
Summary: Previous fix brings in https://github.com/facebook/react-native/pull/42396. Seems it's a mistake to re-add observer? So let's remove it and also not `invalidate` method not be called twice. [IOS] [FIXED] - Remove invalidate observer instead of re-adding observer in DeviceInfo module Pull Request resolved: https://github.com/facebook/react-native/pull/43737 Test Plan: Fix for https://github.com/facebook/react-native/issues/42120 also works. Reviewed By: javache Differential Revision: D55692219 Pulled By: cipolleschi fbshipit-source-id: dba1ddc39a9f2611fc2b84fadf8c23827891379a
This commit is contained in:
committed by
Gabriel Donadel
parent
c7a1f2428f
commit
9db3eb6862
@@ -89,6 +89,9 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (void)invalidate
|
||||
{
|
||||
if (_invalidated) {
|
||||
return;
|
||||
}
|
||||
_invalidated = YES;
|
||||
[self _cleanupObservers];
|
||||
}
|
||||
@@ -109,10 +112,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:RCTWindowFrameDidChangeNotification object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(invalidate)
|
||||
name:RCTBridgeWillInvalidateModulesNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil];
|
||||
}
|
||||
|
||||
static BOOL RCTIsIPhoneNotched()
|
||||
|
||||
Reference in New Issue
Block a user