From f2d5008e90adf135165d368a48a340a348dabf86 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Mon, 8 Apr 2024 09:10:34 -0700 Subject: [PATCH] Fix double metro banner in Bridgeless (#43967) Summary: 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 --- .../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