{"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":"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":7,"created_at":"2015-05-14T15:23:13Z","updated_at":"2015-05-17T11:41:23Z","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/102786691","html_url":"https://github.com/facebook/react-native/issues/1277#issuecomment-102786691","issue_url":"https://api.github.com/repos/facebook/react-native/issues/1277","id":102786691,"user":{"login":"dsibiski","id":2922932,"avatar_url":"https://avatars.githubusercontent.com/u/2922932?v=3","gravatar_id":"","url":"https://api.github.com/users/dsibiski","html_url":"https://github.com/dsibiski","followers_url":"https://api.github.com/users/dsibiski/followers","following_url":"https://api.github.com/users/dsibiski/following{/other_user}","gists_url":"https://api.github.com/users/dsibiski/gists{/gist_id}","starred_url":"https://api.github.com/users/dsibiski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsibiski/subscriptions","organizations_url":"https://api.github.com/users/dsibiski/orgs","repos_url":"https://api.github.com/users/dsibiski/repos","events_url":"https://api.github.com/users/dsibiski/events{/privacy}","received_events_url":"https://api.github.com/users/dsibiski/received_events","type":"User","site_admin":false},"created_at":"2015-05-17T11:41:23Z","updated_at":"2015-05-17T11:41:23Z","body":":+1: on @nicklockwood's suggestion as well. I'm using this method in an existing iOS app and it has been working wonderfully for me.\r\n\r\nI've noticed also that even with this method, there can still be a very slight delay between when the view is pushed and when the content gets rendered. So, in some cases, I'm taking a hybrid approach. Not only do I have the RCTBridge instance in my app delegate, but I also pre-load my RCTRootViews when the calling view loads. Then, when it's time to push the rootView, it's already been loaded and there is no delay at all. Of course, this isn't feasible in all situations (might not work in a UITableView), but it does work."}}