{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/1277","labels_url":"https://api.github.com/repos/facebook/react-native/issues/1277/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/1277/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/1277/events","html_url":"https://github.com/facebook/react-native/issues/1277","id":76392808,"number":1277,"title":"[Perf] Small delay displaying RCTRootView after a push","user":{"login":"marcshilling","id":5598961,"avatar_url":"https://avatars.githubusercontent.com/u/5598961?v=3","gravatar_id":"","url":"https://api.github.com/users/marcshilling","html_url":"https://github.com/marcshilling","followers_url":"https://api.github.com/users/marcshilling/followers","following_url":"https://api.github.com/users/marcshilling/following{/other_user}","gists_url":"https://api.github.com/users/marcshilling/gists{/gist_id}","starred_url":"https://api.github.com/users/marcshilling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcshilling/subscriptions","organizations_url":"https://api.github.com/users/marcshilling/orgs","repos_url":"https://api.github.com/users/marcshilling/repos","events_url":"https://api.github.com/users/marcshilling/events{/privacy}","received_events_url":"https://api.github.com/users/marcshilling/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-05-14T15:23:13Z","updated_at":"2015-06-02T11:02:35Z","closed_at":null,"body":"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:\r\n```\r\nNSURL *jsCodeLocation = [NSURL URLWithString:@\"http://localhost:8081/index.ios.bundle\"];\r\nRCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@\"SimpleApp\" launchOptions:nil];\r\nrootView.frame = self.view.frame;\r\nself.view = rootView;\r\n```\r\n\r\nEverything 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?\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/107916335","html_url":"https://github.com/facebook/react-native/issues/1277#issuecomment-107916335","issue_url":"https://api.github.com/repos/facebook/react-native/issues/1277","id":107916335,"user":{"login":"nicklockwood","id":546885,"avatar_url":"https://avatars.githubusercontent.com/u/546885?v=3","gravatar_id":"","url":"https://api.github.com/users/nicklockwood","html_url":"https://github.com/nicklockwood","followers_url":"https://api.github.com/users/nicklockwood/followers","following_url":"https://api.github.com/users/nicklockwood/following{/other_user}","gists_url":"https://api.github.com/users/nicklockwood/gists{/gist_id}","starred_url":"https://api.github.com/users/nicklockwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicklockwood/subscriptions","organizations_url":"https://api.github.com/users/nicklockwood/orgs","repos_url":"https://api.github.com/users/nicklockwood/repos","events_url":"https://api.github.com/users/nicklockwood/events{/privacy}","received_events_url":"https://api.github.com/users/nicklockwood/received_events","type":"User","site_admin":false},"created_at":"2015-06-02T11:02:35Z","updated_at":"2015-06-02T11:02:35Z","body":"You can load the bridge whenever you want, it doesn't have to be at app launch time. For example, you might load it on the screen before you present your RCTRootView controller so that by the time the user presses the button to display the React view, it's already loaded the JS. You could then throw it away again if they go somewhere else in the app.\r\n\r\nTo avoid the additional delay due to the JS app initialization, you could also try pre-creating the RCTRootView off-screen, and then set it as the root of your view controller when it's presented."}}