From df82b7405ae4ed8da9b305d054073474b8cd1a76 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Mon, 8 Apr 2024 06:30:39 -0700 Subject: [PATCH] Fix double metro banner in Bridgeless 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