From 625d0ece6da80df6e3e3ee7daa1f7f59ddbbf387 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 348355bae359dd..43d4b0bd4b06c6 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm @@ -196,7 +196,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 54d3a470543a57..e94adea579f9d0 100644 --- a/packages/react-native/React/Base/RCTConstants.h +++ b/packages/react-native/React/Base/RCTConstants.h @@ -12,7 +12,7 @@ RCT_EXTERN NSString *const RCTPlatformName; 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 056f6095d8fc06..5f2376cbbafc0b 100644 --- a/packages/react-native/React/Base/RCTConstants.m +++ b/packages/react-native/React/Base/RCTConstants.m @@ -12,7 +12,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 f2d55e334a9a1f..38f8118c733791 100644 --- a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm +++ b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm @@ -73,7 +73,7 @@ - (void)initialize [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(interfaceFrameDidChange) - name:RCTRootViewFrameDidChangeNotification + name:RCTWindowFrameDidChangeNotification object:nil]; }