Unable to resolve module – React Native

  Kiến thức lập trình

I am trying to source an image for my mobile app in react native. But for some reason, the Metro Bundler is giving me an error that it can’t find the image source.
Error:

Unable to resolve module ../assets/images/WelcomeImage.jpg from /Users/jasnoorsandhu51/JayApp/app/Screens/WelcomeScreen.js: 
None of these files exist:
  * WelcomeImage.jpg

Here’s my code:


> function WelcomeScreen(props) {
    return (
        <ImageBackground
            style={styles.background}
            source={require('../assets/images/WelcomeImage.jpg')}
        ></ImageBackground>
    );
}

Here’s my folder structure:
JayApp>app>assests>images>WelcomeImage

I tried checking the spellings of my code to specify the image directory. I have not found any errors though.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT