Forward host:didInitializeRuntime: callback to user delegate (#57438)

Summary:
`RCTReactNativeFactory` acts as `RCTHost`'s delegate but did not implement `host:didInitializeRuntime:`, causing the optional callback to never reach the user's `RCTReactNativeFactoryDelegate`.

Add the missing forwarding method following the same pattern as `hostDidStart:` so the runtime reference is properly delivered to the user delegate.

Fixes https://github.com/react/react-native/issues/57349.

## Changelog:

[IOS] [FIXED] - Forward `host:didInitializeRuntime:` callback to user delegate in `RCTReactNativeFactory`

Pull Request resolved: https://github.com/react/react-native/pull/57438

Test Plan:
1. Implement `host:didInitializeRuntime:` in a custom `RCTReactNativeFactoryDelegate` subclass (e.g. RNTester's `AppDelegate`)
2. Build and launch the app
3. Verify the callback is invoked and the `jsi::Runtime` reference is received
4. Confirm `hostDidStart:` continues to work as before

NOTE: No automated test. This mirrors the existing hostDidStart: forwarding in the same RCTReactNativeFactory, which is also untested. host:didInitializeRuntime: is declared on RCTHostDelegate and inherited by RCTReactNativeFactoryDelegate under optional, and the respondsToSelector: guard makes it a no-op for delegates that don't implement it, so there's no logic to regress. No RCTReactNativeFactory delegate-forwarding test harness exists, so a test would be net-new iOS XCTest scaffolding disproportionate to a one-line forward.

Reviewed By: cortinico

Differential Revision: D113653288

Pulled By: fabriziocucci

fbshipit-source-id: 082bb340cd9d61bc30a10c8a7730eca14f69088e
This commit is contained in:
zhongwuzw authored and meta-codesync[bot] committed 2026-07-27 11:40:57 -07:00
1 parent 433e79d2f4
commit 98dc7d6423
1 file changed
+7
@@ -212,6 +212,13 @@ using namespace facebook::react;
}
}
- (void)host:(RCTHost *)host didInitializeRuntime:(facebook::jsi::Runtime &)runtime
{
if ([_delegate respondsToSelector:@selector(host:didInitializeRuntime:)]) {
[_delegate host:host didInitializeRuntime:runtime];
}
}
- (NSArray<NSString *> *)unstableModulesRequiringMainQueueSetup
{
#if RN_DISABLE_OSS_PLUGIN_HEADER