Closed
Description
I am attempting to integrate React Native into an existing Objective-C app. My goal is to replace a UIViewController
's root UIView
with an RCTRootView
. Following these instructions https://facebook.github.io/react-native/docs/embedded-app.html, I am doing the following in viewDidLoad:
of the view controller:
NSURL *jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"SimpleApp" launchOptions:nil];
rootView.frame = self.view.frame;
self.view = rootView;
Everything works fine, except that there is a very small (maybe half second) delay between when the view controller is pushed and the React Native view is actually displayed. I tried pre-bundling the javascript but there was no difference. I can only assume this is because the javascript is loaded asynchronously. Is there anyway to guarantee the view is loaded so that it is immediately seen upon a push transition?