From 108280f5f00913c751be8c9991f90a05044cb269 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Mon, 16 Oct 2023 07:04:38 -0700 Subject: [PATCH] =?UTF-8?q?Rename=20`RCTRootViewFrameDidChangeNotification?= =?UTF-8?q?`=20as=20it's=20not=20trac=E2=80=A6=20(#39835)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: …king root view frame changes Looking through where this was introduced (https://github.com/facebook/react-native/pull/37649), it seems the notification went from tracking root view size changes to window size changes. However, it was not renamed. I was using it for root view changes in RN-macOS, which.. I guess I'll refactor. Meanwhile, let's update the name? ## Changelog: [IOS] [CHANGED] - Rename `RCTRootViewFrameDidChangeNotification` as it's not tracking root view frame changes Pull Request resolved: https://github.com/facebook/react-native/pull/39835 Test Plan: CI should pass Reviewed By: cipolleschi Differential Revision: D50173742 Pulled By: javache fbshipit-source-id: 4651696174c439800984a5e6cf642200bb9c4f3c --- packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm | 2 +- packages/react-native/React/Base/RCTConstants.h | 2 +- packages/react-native/React/Base/RCTConstants.m | 2 +- packages/react-native/React/CoreModules/RCTDeviceInfo.mm | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm index 923279c8ac6fe0..cc5001e869163a 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm @@ -180,7 +180,7 @@ - (void)windowScene:(UIWindowScene *)windowScene interfaceOrientation:(UIInterfaceOrientation)previousInterfaceOrientation traitCollection:(UITraitCollection *)previousTraitCollection API_AVAILABLE(ios(13.0)) { - [[NSNotificationCenter defaultCenter] postNotificationName:RCTRootViewFrameDidChangeNotification object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:RCTWindowFrameDidChangeNotification object:self]; } #pragma mark - RCTCxxBridgeDelegate diff --git a/packages/react-native/React/Base/RCTConstants.h b/packages/react-native/React/Base/RCTConstants.h index acdef2557dfe46..5132fdab5902c0 100644 --- a/packages/react-native/React/Base/RCTConstants.h +++ b/packages/react-native/React/Base/RCTConstants.h @@ -10,7 +10,7 @@ RCT_EXTERN NSString *const RCTUserInterfaceStyleDidChangeNotification; RCT_EXTERN NSString *const RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey; -RCT_EXTERN NSString *const RCTRootViewFrameDidChangeNotification; +RCT_EXTERN NSString *const RCTWindowFrameDidChangeNotification; /** * This notification fires when the bridge initializes. diff --git a/packages/react-native/React/Base/RCTConstants.m b/packages/react-native/React/Base/RCTConstants.m index e7673378008395..99b68f8c8d4775 100644 --- a/packages/react-native/React/Base/RCTConstants.m +++ b/packages/react-native/React/Base/RCTConstants.m @@ -10,7 +10,7 @@ NSString *const RCTUserInterfaceStyleDidChangeNotification = @"RCTUserInterfaceStyleDidChangeNotification"; NSString *const RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey = @"traitCollection"; -NSString *const RCTRootViewFrameDidChangeNotification = @"RCTRootViewFrameDidChangeNotification"; +NSString *const RCTWindowFrameDidChangeNotification = @"RCTWindowFrameDidChangeNotification"; NSString *const RCTJavaScriptDidFailToLoadNotification = @"RCTJavaScriptDidFailToLoadNotification"; NSString *const RCTJavaScriptDidLoadNotification = @"RCTJavaScriptDidLoadNotification"; diff --git a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm index bd28fff0537ac9..e31e672c5311ed 100644 --- a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm +++ b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm @@ -79,7 +79,7 @@ - (void)initialize #endif // [macOS] [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(interfaceFrameDidChange) - name:RCTRootViewFrameDidChangeNotification + name:RCTWindowFrameDidChangeNotification object:nil]; }