{"action":"created","issue":{"url":"https://api.github.com/repos/wix/react-native-navigation/issues/3549","repository_url":"https://api.github.com/repos/wix/react-native-navigation","labels_url":"https://api.github.com/repos/wix/react-native-navigation/issues/3549/labels{/name}","comments_url":"https://api.github.com/repos/wix/react-native-navigation/issues/3549/comments","events_url":"https://api.github.com/repos/wix/react-native-navigation/issues/3549/events","html_url":"https://github.com/wix/react-native-navigation/issues/3549","id":340986283,"node_id":"MDU6SXNzdWUzNDA5ODYyODM=","number":3549,"title":"[V2] How to set root component for multiple screens (like Provider for Context or Redux)","user":{"login":"pie6k","id":7311462,"node_id":"MDQ6VXNlcjczMTE0NjI=","avatar_url":"https://avatars0.githubusercontent.com/u/7311462?v=4","gravatar_id":"","url":"https://api.github.com/users/pie6k","html_url":"https://github.com/pie6k","followers_url":"https://api.github.com/users/pie6k/followers","following_url":"https://api.github.com/users/pie6k/following{/other_user}","gists_url":"https://api.github.com/users/pie6k/gists{/gist_id}","starred_url":"https://api.github.com/users/pie6k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pie6k/subscriptions","organizations_url":"https://api.github.com/users/pie6k/orgs","repos_url":"https://api.github.com/users/pie6k/repos","events_url":"https://api.github.com/users/pie6k/events{/privacy}","received_events_url":"https://api.github.com/users/pie6k/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-13T11:37:39Z","updated_at":"2018-07-24T21:11:56Z","closed_at":null,"author_association":"NONE","body":"I need all screens to be wrapped inside the same instance of Provider component. \r\n\r\nIn version 1 of react-native-navigation there was 3rd parameter of `registerComponent` that was allowing that.\r\n\r\nIs it possible in v2?\r\n\r\nExample:\r\n\r\nIn case like this:\r\nhttps://reactjs.org/docs/context.html#updating-context-from-a-nested-component\r\n\r\nContext value is based on root component state. This requires, however, to have only single instance of this root component. When I'm registering component inside `react-native-navigation` I need to pass this root component everytime (so it's not the same instance), so it have different internal state, so it's not possible to sync context between multiple screens.\r\n\r\n---\r\n### Environment\r\n* React Native Navigation version: 2.0.2410\r\n* React Native version: 0.56.0\r\n* Platform(s) (iOS, Android, or both?): iOS\r\n* Device info (Simulator/Device? OS version? Debug/Release?): Simulator\r\n"},"comment":{"url":"https://api.github.com/repos/wix/react-native-navigation/issues/comments/407553700","html_url":"https://github.com/wix/react-native-navigation/issues/3549#issuecomment-407553700","issue_url":"https://api.github.com/repos/wix/react-native-navigation/issues/3549","id":407553700,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzU1MzcwMA==","user":{"login":"sturmenta","id":30802967,"node_id":"MDQ6VXNlcjMwODAyOTY3","avatar_url":"https://avatars3.githubusercontent.com/u/30802967?v=4","gravatar_id":"","url":"https://api.github.com/users/sturmenta","html_url":"https://github.com/sturmenta","followers_url":"https://api.github.com/users/sturmenta/followers","following_url":"https://api.github.com/users/sturmenta/following{/other_user}","gists_url":"https://api.github.com/users/sturmenta/gists{/gist_id}","starred_url":"https://api.github.com/users/sturmenta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sturmenta/subscriptions","organizations_url":"https://api.github.com/users/sturmenta/orgs","repos_url":"https://api.github.com/users/sturmenta/repos","events_url":"https://api.github.com/users/sturmenta/events{/privacy}","received_events_url":"https://api.github.com/users/sturmenta/received_events","type":"User","site_admin":false},"created_at":"2018-07-24T21:11:56Z","updated_at":"2018-07-24T21:11:56Z","author_association":"NONE","body":"I solved it in this way:\r\n```javascript\r\nconst wrapWithToastProvider = Comp => props => (\r\n\t<ToastProvider>\r\n\t\t<Comp {...props} />\r\n\t</ToastProvider>\r\n);\r\n\r\nNavigation.registerComponent('myschool.login', () => wrapWithToastProvider(Login), store, ReduxProvider);\r\n```"}}
{"actor":{"display_login":"sturmenta"}}