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
This commit is contained in:
Riccardo Cipolleschi
2024-04-08 11:16:38 -07:00
committed by Facebook GitHub Bot
parent f4a3deb3c6
commit 64ed8200f7
@@ -31,7 +31,6 @@
#import <React/RCTModuleData.h>
#import <React/RCTPerformanceLogger.h>
#import <React/RCTRedBox.h>
#import <React/RCTReloadCommand.h>
#import <React/RCTSurfacePresenter.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <ReactCommon/RuntimeExecutor.h>
@@ -136,11 +135,6 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
name:@"RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED"
object:nil];
[defaultCenter addObserver:self
selector:@selector(didReceiveReloadCommand)
name:RCTTriggerReloadCommandNotification
object:nil];
[self _start];
}
return self;
@@ -519,9 +513,4 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
isFatal:error.isFatal];
}
- (void)didReceiveReloadCommand
{
[self _loadJSBundle:[_bridgeModuleDecorator.bundleManager bundleURL]];
}
@end