How to reference a launch image in React Native

300 views Asked by At

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?

2

There are 2 answers

1
HABEEB RAHMAN PT On BEST ANSWER

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

5
Malik Hezret On

Try using Image Background tag e.g

  <ImageBackground source={...} style={{width: '100%', height: '100%'}}>
    <Text>Inside</Text>
  </ImageBackground>