From 5ae8fab4c3e9d83dbae868f16ed875570fcaff74 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 24 May 2024 14:39:19 -0500 Subject: [PATCH] Pick up hpotfix --- packages/react-native/React/CoreModules/RCTDeviceInfo.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm index 69553fbd516787..6bc2b195cc747d 100644 --- a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm +++ b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm @@ -98,6 +98,9 @@ - (void)initialize - (void)invalidate { + if (_invalidated) { + return; + } _invalidated = YES; [self _cleanupObservers]; } @@ -120,10 +123,7 @@ - (void)_cleanupObservers [[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()