Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [iOS] RCTReloadCommand should pass its bundleURL when reloading #44130

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/react-native/React/Base/RCTBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ - (RCTBridgeModuleDecorator *)bridgeModuleDecorator

- (void)didReceiveReloadCommand
{
[self didReceiveReloadCommand:nil];
}

- (void)didReceiveReloadCommand:(NSURL *)bundleURL
{
if (bundleURL) {
_bundleURL = bundleURL;
}
#if RCT_ENABLE_INSPECTOR
auto &inspectorFlags = facebook::react::jsinspector_modern::InspectorFlags::getInstance();
if (!inspectorFlags.getEnableModernCDPRegistry()) {
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/React/Base/RCTReloadCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
@protocol RCTReloadListener
- (void)didReceiveReloadCommand;
- (void)didReceiveReloadCommand:(NSURL * _Nullable)bundleURL;
@end

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/React/Base/RCTReloadCommand.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void RCTTriggerReloadCommandListeners(NSString *reason)
}];

for (id<RCTReloadListener> l in [listeners allObjects]) {
[l didReceiveReloadCommand];
[l didReceiveReloadCommand:bundleURL];
}
[listenersLock unlock];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,18 @@ - (void)callFunctionOnJSModule:(NSString *)moduleName method:(NSString *)method
#pragma mark - RCTReloadListener

- (void)didReceiveReloadCommand
{
[self didReceiveReloadCommand:nil];
}

- (void)didReceiveReloadCommand:(NSURL * _Nullable)bundleURL
{
[_instance invalidate];
_instance = nil;
if (_bundleURLProvider) {
if (bundleURL) {
[self _setBundleURL:bundleURL];
}
else if (_bundleURLProvider) {
[self _setBundleURL:_bundleURLProvider()];
}

Expand Down
Loading