{"action":"created","issue":{"url":"https://api.github.com/repos/ohanhi/elm-native-ui/issues/50","repository_url":"https://api.github.com/repos/ohanhi/elm-native-ui","labels_url":"https://api.github.com/repos/ohanhi/elm-native-ui/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/ohanhi/elm-native-ui/issues/50/comments","events_url":"https://api.github.com/repos/ohanhi/elm-native-ui/issues/50/events","html_url":"https://github.com/ohanhi/elm-native-ui/pull/50","id":194425274,"number":50,"title":"Don't require JavaScript modules dynamically","user":{"login":"jsteiner","id":466493,"avatar_url":"https://avatars.githubusercontent.com/u/466493?v=3","gravatar_id":"","url":"https://api.github.com/users/jsteiner","html_url":"https://github.com/jsteiner","followers_url":"https://api.github.com/users/jsteiner/followers","following_url":"https://api.github.com/users/jsteiner/following{/other_user}","gists_url":"https://api.github.com/users/jsteiner/gists{/gist_id}","starred_url":"https://api.github.com/users/jsteiner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsteiner/subscriptions","organizations_url":"https://api.github.com/users/jsteiner/orgs","repos_url":"https://api.github.com/users/jsteiner/repos","events_url":"https://api.github.com/users/jsteiner/events{/privacy}","received_events_url":"https://api.github.com/users/jsteiner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-08T19:39:39Z","updated_at":"2016-12-09T07:04:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ohanhi/elm-native-ui/pulls/50","html_url":"https://github.com/ohanhi/elm-native-ui/pull/50","diff_url":"https://github.com/ohanhi/elm-native-ui/pull/50.diff","patch_url":"https://github.com/ohanhi/elm-native-ui/pull/50.patch"},"body":"In release mode, React Native's packager replaces the module name passed\r\nto `require` with an ID. This means that [requiring a dynamic module name](https://github.com/ohanhi/elm-native-ui/blob/300ef5b757f60fa5df6bb5858c32eb2ab83de91a/src/Native/NativeUi.js#L268)\r\nwon't work in release mode, because the module name can't be found."},"comment":{"url":"https://api.github.com/repos/ohanhi/elm-native-ui/issues/comments/265947949","html_url":"https://github.com/ohanhi/elm-native-ui/pull/50#issuecomment-265947949","issue_url":"https://api.github.com/repos/ohanhi/elm-native-ui/issues/50","id":265947949,"user":{"login":"benansell","id":684667,"avatar_url":"https://avatars.githubusercontent.com/u/684667?v=3","gravatar_id":"","url":"https://api.github.com/users/benansell","html_url":"https://github.com/benansell","followers_url":"https://api.github.com/users/benansell/followers","following_url":"https://api.github.com/users/benansell/following{/other_user}","gists_url":"https://api.github.com/users/benansell/gists{/gist_id}","starred_url":"https://api.github.com/users/benansell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benansell/subscriptions","organizations_url":"https://api.github.com/users/benansell/orgs","repos_url":"https://api.github.com/users/benansell/repos","events_url":"https://api.github.com/users/benansell/events{/privacy}","received_events_url":"https://api.github.com/users/benansell/received_events","type":"User","site_admin":false},"created_at":"2016-12-09T07:04:53Z","updated_at":"2016-12-09T07:04:53Z","body":"I also found this recently when upgrading to the latest version of react-native. I have gone down the route of adding the require statements to the index.*.js files and passing them into the elm app initialisation code so that they can be used by the app to create the custom components.\r\n\r\n```js\r\nconst modules = {\r\n  'Animated': require('Animated'),\r\n  'NavigationExperimental': require('NavigationExperimental'),\r\n  'NavigationCardStack': require('NavigationCardStack'),\r\n  'NavigationHeader': require('NavigationHeader'),\r\n  'NavigationHeaderTitle': require('NavigationHeaderTitle')\r\n};\r\n\r\nconst component = Elm.Main.start(modules);\r\n```\r\n\r\nThis has worked well for me by ensuring only the modules required by the app are picked up by the packager. It also allows easier extension / inclusion of 3rd party components (like gl-react-native) without requiring each app to know about them.  However, the obvious downside is that it more complex for people to get started with elm-native-ui as they would need to understand which require statements are needed for their app.\r\n\r\n"}}
{"actor":{"display_login":"benansell"}}