When running the project I get the following error message:
Unable to resolve "./assets/logo.png" from "app\resources\views\screens\Splash.js"
import React from 'react';
import { StyleSheet, Image, View } from 'react-native';
import logo from './assets/logo.png';
It should be noted that the image is correctly hosted in the directory and the way I try to add it is:
<Image source={logo} style={{ width: 305, height: 159 }} />
- Add image documentation: https://docs.expo.io/tutorial/image/
According to the
EXPO
Images/Static Image Resources documentation :Unlike static assets, you'll need to manually specify the dimensions of your image. It is strongly recommended that you use https as well to satisfy app transport security requirements on iOS.
React Native provides a unified way to manage images and other media assets across your Android and iOS apps. To add a static image to your app, put it somewhere in your source tree and reference it like this:
If there is another alternative that solves this problem:
<Image source={require('./my-icon.png')} />
it would not hurt to know a solution.Modify the image extension as follows: image.png by image.android.png or image.ios.png and finally <Image source={require('./assets/img/image.android.png')} />