Sunday, November 15, 2015

Local Images in React-Native IOS

Looks familiar?
There are several ways to use local images in a react-native app:

  1. Using xcassets folder - source={require('image!bg')}. The images must be in the xcassets folder and according to the docs you should have the image in all the 3 sizes.
  2. Relative path - source={require('./bg.png')}. Note that you have to add the file sufix.
  3. The way it actually works - source={{ uri: "google", isStatic: true }} instead of require('image!google'). This way you can use both images that are in your xcassets folder and those that are not without killing yourself while trying to find the right relative path.

If you got here then you've probably started to use React-Native - don't give up yet- it's awesome!


  1. In this present era of digitalization, a mobile application is one of the primary necessities for today’s modern-age businesses to stand-out in the industry, including even the top Indian app developers of the market are swapping towards mobile applications rather than the ordinary websites. The applications developed through cross-platform are apparently becoming more prevalent in the market, and React Native is one of the most preferred cross-platform development solutions by the developers as it allows them to preserves native platform compatibilities through react development.

  2. It's really a nice and helpful piece of information. Thank you for sharing this with us. React Native App Development