From 64ed8200f739b0e8289ec7336557fa3d5d381b97 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Mon, 8 Apr 2024 11:16:38 -0700 Subject: [PATCH] Fix double metro banner in Bridgeless (#43967) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43967 Following up https://github.com/facebook/react-native/issues/43943, the metro loading banner is presented twice in Bridgeless mode. This happens because both the RCTInstance and the RCTHost are listening to the Reload Command and issuing the instructions to refetch the JSBundle and to present the banner. The RCTInstance should not concern itself with lifecycle events, owned by the RCTHost. ## Changelog: [iOS][Fixed] - Avoid to show Metro Loading banner twice. Reviewed By: cortinico Differential Revision: D55870640 fbshipit-source-id: addb67d3226f7d7db20736309172a42fc15f3aa3 --- .../runtime/platform/ios/ReactCommon/RCTInstance.mm | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm index deaf2124c91878..31a18620bd89c4 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm @@ -31,7 +31,6 @@ #import #import #import -#import #import #import #import @@ -136,11 +135,6 @@ - (instancetype)initWithDelegate:(id)delegate name:@"RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED" object:nil]; - [defaultCenter addObserver:self - selector:@selector(didReceiveReloadCommand) - name:RCTTriggerReloadCommandNotification - object:nil]; - [self _start]; } return self; @@ -519,9 +513,4 @@ - (void)_handleJSError:(const JsErrorHandler::ParsedError &)error isFatal:error.isFatal]; } -- (void)didReceiveReloadCommand -{ - [self _loadJSBundle:[_bridgeModuleDecorator.bundleManager bundleURL]]; -} - @end