diff --git a/packages/react-native-sandbox/ios/SandboxReactNativeViewComponentView.mm b/packages/react-native-sandbox/ios/SandboxReactNativeViewComponentView.mm index e331077..9025afe 100644 --- a/packages/react-native-sandbox/ios/SandboxReactNativeViewComponentView.mm +++ b/packages/react-native-sandbox/ios/SandboxReactNativeViewComponentView.mm @@ -67,6 +67,9 @@ - (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]; @@ -74,6 +77,7 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & if (oldViewProps.jsBundleSource != newViewProps.jsBundleSource) { [self.reactNativeDelegate setJsBundleSource:newViewProps.jsBundleSource]; + bundleSourceChanged = YES; } if (oldViewProps.allowedTurboModules != newViewProps.allowedTurboModules) { @@ -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]; + } else if (oldViewProps.componentName != newViewProps.componentName || + oldViewProps.initialProperties != newViewProps.initialProperties || + oldViewProps.launchOptions != newViewProps.launchOptions) { [self scheduleReactViewLoad]; } }