Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,17 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &

[super updateProps:props oldProps:oldProps];

// Track if bundle source changed - needs special handling
BOOL bundleSourceChanged = NO;

if (self.reactNativeDelegate) {
if (oldViewProps.origin != newViewProps.origin) {
[self.reactNativeDelegate setOrigin:newViewProps.origin];
}

if (oldViewProps.jsBundleSource != newViewProps.jsBundleSource) {
[self.reactNativeDelegate setJsBundleSource:newViewProps.jsBundleSource];
bundleSourceChanged = YES;
}

if (oldViewProps.allowedTurboModules != newViewProps.allowedTurboModules) {
Expand All @@ -96,9 +100,13 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
[self updateEventEmitterIfNeeded];
}

if (oldViewProps.componentName != newViewProps.componentName ||
oldViewProps.initialProperties != newViewProps.initialProperties ||
oldViewProps.launchOptions != newViewProps.launchOptions) {
// When bundle source changes, we must destroy the factory to force reload with new bundle
if (bundleSourceChanged) {
self.reactNativeFactory = nil;
[self scheduleReactViewLoad];
Comment on lines +104 to +106
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contribution

Probably recreating factory is overkill here, we simply should reload updated jsBundeUrl i.e. something like RCTTriggerReloadCommandListeners or [RCTBridge reloadWithReason:] would be better

} else if (oldViewProps.componentName != newViewProps.componentName ||
oldViewProps.initialProperties != newViewProps.initialProperties ||
oldViewProps.launchOptions != newViewProps.launchOptions) {
[self scheduleReactViewLoad];
}
}
Expand Down