Pass initial props to JS in detached iOS app

Is there any way to customise the initial props passed to my root <App> component when running a detached iOS app?
I have been able to do this in android by overriding MainActivity.initialProps but I cannot find an equivalent feature on iOS.

I see that React Native allows you to do this on iOS by using properties on RCTRootView but it seems that this root view is managed by Expo and I can’t seem to get access to it.

Thanks

If you just need to pass in some static set of props, the easiest thing to do is use the extra key in app.json: https://docs.expo.io/versions/latest/workflow/configuration#extra

If you need to modify the initial props with some native objective-C logic for whatever reason, we don’t currently expose an easy hook for this. You could subclass EXViewController and modify this logic: https://github.com/expo/expo/blob/master/ios/Exponent/ExpoKit/EXViewController.m#L45-L46 and then set the rootViewControllerClass on the ExpoKit singleton to your custom subclass.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.