Skip to content

Instantly share code, notes, and snippets.

@StefanWallin
Last active February 24, 2016 16:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StefanWallin/3abbb026c03615545bd8 to your computer and use it in GitHub Desktop.
Save StefanWallin/3abbb026c03615545bd8 to your computer and use it in GitHub Desktop.
Including static images in React Native not working :(
Requiring unknown module "image!backdrop". If you are sure the module is there, try restarting the packager.
var backdrop = (
<Image source={require('image!backdrop')}>
<Text style={styles.welcome}>heading</Text>
</Image>
);
$ ls -1 iOS/Images.xcassets/backdrop.imageset/
Contents.json
backdrop-1.jpg
backdrop-2.jpg
backdrop.jpg
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "backdrop.jpg"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "backdrop-1.jpg"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "backdrop-2.jpg"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment