Skip to content

RCTHostDelegate's host:didInitializeRuntime: did not get invoked on iOS & tvOS #57349

Description

@killmyrene

Description

I found that on v0.85 that this callback on RCTHostDelegate (void)host:(RCTHost*)host didInitializeRuntime:(Runtime&)rt doesn't get invoked at all on app startup. Further investigation have found that the RCTReactNativeFactory class is set to be the RCTHost's delegate but the RCTReactNativeFactory class itself doesn't have the method host:didInitializeRuntime: defined on it.

This makes the delegate itself useless unless i created a subclass of RCTReactNativeFactory to implement the missing method.

We use this method as a mean to store the runtime passed for any JSI calls to be made on the native side to the Javascript side

@implementation ReactNativeDelegate

#pragma mark - RCTHostDelegate
- (void)host:(RCTHost*)host didInitializeRuntime:(Runtime&)rt {
    //This callback is not invoked
     ...
}

@end 
@Implementation AppDelegate
- (BOOL)application:(UIApplication*)application
    didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
...
    ReactNativeDelegate* delegate = [ReactNativeDelegate new]; //RCTHostDelegate inheritor
    RCTReactNativeFactory* factory =
        [[RCTReactNativeFactory alloc] initWithDelegate:delegate
                                           releaseLevel:releaseLevel];

    self.reactNativeDelegate = delegate;
    self.reactNativeFactory = factory;
...
}
...
@end

Steps to reproduce

Just startup the app on iOS or tvOS

React Native Version

0.85

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info

pp696r@DTVFXLVYH62M6 ios % npx @react-native-community/cli info
info Fetching system and libraries information...
System:
  OS: macOS 26.5
  CPU: (18) arm64 Apple M5 Pro
  Memory: 63.41 MB / 48.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 24.13.0
    path: ~/.nvm/versions/node/v24.13.0/bin/node
  Yarn:
    version: 4.10.3
    path: ~/.nvm/versions/node/v24.13.0/bin/yarn
  npm:
    version: 11.6.2
    path: ~/.nvm/versions/node/v24.13.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.13.0
    path: /Users/pp696r/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.2
      - iOS 26.2
      - macOS 26.2
      - tvOS 26.2
      - visionOS 26.2
      - watchOS 26.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.3 AI-253.32098.37.2534.15336583
  Xcode:
    version: 26.2/17C52
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 22.0.1
    path: /usr/bin/javac
  Ruby:
    version: 2.7.5
    path: /Users/pp696r/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

info React Native v0.86.0 is now available (your project is running on v0.85.3).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.86.0
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.85.3&to=0.86.0
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".

Stacktrace or Logs

None

MANDATORY Reproducer

NA

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions