{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/2481","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/2481/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/2481/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/2481/events","html_url":"https://github.com/facebook/react-native/issues/2481","id":103723861,"number":2481,"title":"Setting <Image /> source with string concatenation fails ('Requiring unknown module...')","user":{"login":"gavinsmith","id":465932,"avatar_url":"https://avatars1.githubusercontent.com/u/465932?v=3","gravatar_id":"","url":"https://api.github.com/users/gavinsmith","html_url":"https://github.com/gavinsmith","followers_url":"https://api.github.com/users/gavinsmith/followers","following_url":"https://api.github.com/users/gavinsmith/following{/other_user}","gists_url":"https://api.github.com/users/gavinsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinsmith/subscriptions","organizations_url":"https://api.github.com/users/gavinsmith/orgs","repos_url":"https://api.github.com/users/gavinsmith/repos","events_url":"https://api.github.com/users/gavinsmith/events{/privacy}","received_events_url":"https://api.github.com/users/gavinsmith/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2015-08-28T14:01:38Z","updated_at":"2017-04-26T01:03:16Z","closed_at":"2015-08-28T14:10:10Z","body":"I've seen this mentioned before: https://github.com/facebook/react-native/issues/282#issuecomment-96908438\n\nI'm trying to include an image from within the project, the name of which is dependant on variables.\n\n```\nvar imageName = `image!${var1}_of_${var2}`\ncontents = (\n  <Image source={require(imageName)} style={styles.card} onPress={this._onPress} />\n)\n```\n\nThe above fails with the usual:\n\n> Requiring unknown module \"image!somwething_for_somethingelse\". If you are sure the module is there, try restarting the packager.\n\nThese also fail in the same manner:\n\n`<Image source={require(`image!${var1}_of_${var2}`)}>`\n`<Image source={require('image!' + {var1} + '_of_' + {var2})} >`\n\nThis works, no problem:\n\n`<Image source={require('image!somwething_for_somethingelse')}>`\n\nI've also tried\n- Stop and re-build Xcode project\n- Restarting the packager\n"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/297207960","html_url":"https://github.com/facebook/react-native/issues/2481#issuecomment-297207960","issue_url":"https://api.github.com/repos/facebook/react-native/issues/2481","id":297207960,"user":{"login":"dalianmao22233","id":10527637,"avatar_url":"https://avatars3.githubusercontent.com/u/10527637?v=3","gravatar_id":"","url":"https://api.github.com/users/dalianmao22233","html_url":"https://github.com/dalianmao22233","followers_url":"https://api.github.com/users/dalianmao22233/followers","following_url":"https://api.github.com/users/dalianmao22233/following{/other_user}","gists_url":"https://api.github.com/users/dalianmao22233/gists{/gist_id}","starred_url":"https://api.github.com/users/dalianmao22233/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dalianmao22233/subscriptions","organizations_url":"https://api.github.com/users/dalianmao22233/orgs","repos_url":"https://api.github.com/users/dalianmao22233/repos","events_url":"https://api.github.com/users/dalianmao22233/events{/privacy}","received_events_url":"https://api.github.com/users/dalianmao22233/received_events","type":"User","site_admin":false},"created_at":"2017-04-26T01:03:16Z","updated_at":"2017-04-26T01:03:16Z","body":"same problem. how could I concat my variable to the image path... Is there any other solution?"}}
{"actor":{"display_login":"dalianmao22233"}}