{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/1339","labels_url":"https://api.github.com/repos/facebook/react-native/issues/1339/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/1339/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/1339/events","html_url":"https://github.com/facebook/react-native/issues/1339","id":78014556,"number":1339,"title":"[Bridge] It takes a lot of time when RCTDatePickerManager exports its constants","user":{"login":"cxfeng1","id":1625893,"avatar_url":"https://avatars.githubusercontent.com/u/1625893?v=3","gravatar_id":"","url":"https://api.github.com/users/cxfeng1","html_url":"https://github.com/cxfeng1","followers_url":"https://api.github.com/users/cxfeng1/followers","following_url":"https://api.github.com/users/cxfeng1/following{/other_user}","gists_url":"https://api.github.com/users/cxfeng1/gists{/gist_id}","starred_url":"https://api.github.com/users/cxfeng1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cxfeng1/subscriptions","organizations_url":"https://api.github.com/users/cxfeng1/orgs","repos_url":"https://api.github.com/users/cxfeng1/repos","events_url":"https://api.github.com/users/cxfeng1/events{/privacy}","received_events_url":"https://api.github.com/users/cxfeng1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"tadeuzagallo","id":764414,"avatar_url":"https://avatars.githubusercontent.com/u/764414?v=3","gravatar_id":"","url":"https://api.github.com/users/tadeuzagallo","html_url":"https://github.com/tadeuzagallo","followers_url":"https://api.github.com/users/tadeuzagallo/followers","following_url":"https://api.github.com/users/tadeuzagallo/following{/other_user}","gists_url":"https://api.github.com/users/tadeuzagallo/gists{/gist_id}","starred_url":"https://api.github.com/users/tadeuzagallo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tadeuzagallo/subscriptions","organizations_url":"https://api.github.com/users/tadeuzagallo/orgs","repos_url":"https://api.github.com/users/tadeuzagallo/repos","events_url":"https://api.github.com/users/tadeuzagallo/events{/privacy}","received_events_url":"https://api.github.com/users/tadeuzagallo/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-05-19T09:38:24Z","updated_at":"2015-05-29T23:27:51Z","closed_at":null,"body":"I'm using react native partially in my application.  So `RCTBridge` is not initialized until it is used.\r\n\r\nI find that method `constantsToExport` of `RCTDatePickerManager` takes a lot of time when `RCTBridge` is being initialized:\r\n\r\n```\r\n- (NSDictionary *)constantsToExport\r\n{\r\n  UIDatePicker *dp = [[UIDatePicker alloc] init];\r\n  [dp layoutIfNeeded];\r\n\r\n  return @{\r\n    @\"ComponentHeight\": @(CGRectGetHeight(dp.frame)),\r\n    @\"ComponentWidth\": @(CGRectGetWidth(dp.frame)),\r\n    @\"DatePickerModes\": @{\r\n      @\"time\": @(UIDatePickerModeTime),\r\n      @\"date\": @(UIDatePickerModeDate),\r\n      @\"datetime\": @(UIDatePickerModeDateAndTime),\r\n    }\r\n  };\r\n}\r\n```\r\n\r\n`layoutIfNeeded` takes about 0.5 second each time and it is invoked twice! \r\n\r\nNo problem when the bridge is initialized on launch.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/106957888","html_url":"https://github.com/facebook/react-native/issues/1339#issuecomment-106957888","issue_url":"https://api.github.com/repos/facebook/react-native/issues/1339","id":106957888,"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-05-29T23:27:51Z","updated_at":"2015-05-29T23:27:51Z","body":"Maybe we should just hard-code the values in this case. They've never changed since the date picker was first introduced AFAIK, and if they ever do we can add some OS-based branching."}}