remove incorrect call of removeObserver from RCTDeviceInfo (#49551)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49551

changelog: [internal]

in recent commit, https://github.com/facebook/react-native/commit/470bc4088957920aa55c8e5ccf3c9f4259c0694c, use of KVO was removed.
But `removeObserver` when `addObserver` was not called leads to a crash and must be removed as well.

Reviewed By: cipolleschi

Differential Revision: D69918158

fbshipit-source-id: ad65273e74545eba77ab35c5e22c28bddf072f9f
This commit is contained in:
Samuel Susla
2025-02-20 08:25:29 -08:00
committed by Facebook GitHub Bot
parent 38190f530f
commit 3d1c1b50fe
@@ -33,8 +33,6 @@ using namespace facebook::react;
std::atomic<BOOL> _invalidated;
}
static NSString *const kFrameKeyPath = @"frame";
@synthesize moduleRegistry = _moduleRegistry;
RCT_EXPORT_MODULE()
@@ -122,8 +120,6 @@ RCT_EXPORT_MODULE()
[[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil];
[RCTKeyWindow() removeObserver:self forKeyPath:kFrameKeyPath];
#if TARGET_OS_IOS
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
#endif