react-nativelaunchimage

How to reference a launch image in React Native


I'd like to use an iOS launch image as a background image in my React app, but I can't figure out how to reference it. I've tried a few things similar to the following:

<Image source={{uri: "LaunchImage"}} />

But I'm getting this error:

Module `LaunchImage` does not exist in the Haste module map`.

Any ideas?


Solution

  • Please include an image in your project src folder and please call image path using require() like this

    <Image source={{uri: require('../Images/LaunchImage.png')}} />
    

    here LaunchImage.png is its file name and 'Images' is the folder name