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!

7 comments:

  1. Rails is basically a web application framework, which is consist of everything needs to create database baked web application. It helps the developers to create websites and applications by providing structures for all codes written by them. Moreover, common repetitive tasks are simplified with the help of this technology.
    ruby on rails software house
    Popular rails gems and APIs
    Websites made with ruby
    Best ruby gems 2019
    React native and React Js

    ReplyDelete
  2. 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.

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

    ReplyDelete
  4. Jessica Morris1/26/22, 9:42 AM

    Nicely Explained. To support the demand of React native app development, I would also like to share that the React Native framework is ideal for sophisticated multi-platform app development and with mobile app revenues expected to reach $935 billion 2023, RN is primed for growth. Constantly, top react native app development company in the USA are growing rapidly with the increasing demand of cross platform mobile apps.

    ReplyDelete