does not show local images

Please provide the following:

  1. SDK Version: “expo”: “^40.0.0”,
  2. Platforms(Android/iOS/web/all): android

Hello everyone!

Faced a problem trying to display pictures from the local directory - they are not displayed. I add new pictures, try to display - it does not work. In fact, I cannot display local images from the resources folder, except for the standard icons - icon.png, splash.png. The bottom line is that pictures are imported through
export const exampleImage =
Image.resolveAssetSource(require (’…/assets/images/example.png’)).uri.

Next in the component .tsx -
<Image
source={{
uri: exampleImage
}}
/>

I tried to remove / install again node_modules, cleaned the cache - nothing happens. Any help is appreciated, I will be grateful for your help. Thank you
My package.json

“dependencies”: {

"@codler/react-native-keyboard-aware-scroll-view": "^1.0.1",

"@expo/vector-icons": "^12.0.2",

"@react-native-community/masked-view": "^0.1.10",

"@react-native-community/picker": "^1.8.1",

"@react-navigation/bottom-tabs": "^5.9.1",

"@react-navigation/native": "^5.7.3",

"@react-navigation/stack": "^5.9.0",

"@types/jest": "^26.0.19",

"@types/react": "^17.0.0",

"@types/react-native": "0.63.40",

"@types/react-native-snap-carousel": "^3.8.3",

"@types/react-test-renderer": "^17.0.1",

"babel-jest": "^26.6.3",

"eslint": "^7.15.0",

"expo": "^40.0.0",

"expo-asset": "^8.2.1",

"expo-camera": "^9.1.0",

"expo-constants": "^9.3.5",

"expo-font": "^8.4.0",

"expo-image-loader": "1.3.0",

"expo-image-picker": "^9.2.1",

"expo-linear-gradient": "^8.4.0",

"expo-location": "^10.0.0",

"expo-permissions": "^10.0.0",

"jest-css-modules-transform": "^4.2.1",

"jest-expo": "^41.0.0",

"lottie-react-native": "2.6.1",

"mobx": "^6.0.4",

"mobx-react": "^7.0.5",

"native-base": "^2.15.0",

"prop-types": "^15.7.2",

"react": "^17.0.1",

"react-devtools-core": "^4.10.1",

"react-dom": "^17.0.1",

"react-native": "^0.63.4",

"react-native-animatable": "^1.3.3",

"react-native-elements": "^3.0.0-alpha.1",

"react-native-fast-image": "^8.3.4",

"react-native-gesture-handler": "1.8.0",

"react-native-maps": "^0.27.1",

"react-native-paper": "^4.4.1",

"react-native-reanimated": "^1.13.0",

"react-native-remote-svg": "^2.0.6",

"react-native-safe-area-context": "^3.1.9",

"react-native-scalable-image": "^1.0.0",

"react-native-screens": "2.15.2",

"react-native-snap-carousel": "^3.9.1",

"react-native-svg": "^12.1.0",

"react-native-swiper": "^1.6.0",

"react-native-textinput-effects": "^0.6.1",

"react-native-unimodules": "^0.13.3",

"react-native-vector-icons": "^8.0.0",

"react-native-web": "^0.14.9",

"react-native-web-swiper": "^2.1.7",

"react-native-webview": "11.0.0",

"react-navigation": "^4.4.3",

"react-test-renderer": "^17.0.2",

"ts-jest": "^26.5.6",

"ts-node": "^9.1.1",

"typescript": "^4.2.4"

},

“devDependencies”: {

"@babel/core": "^7.14.2",

"@babel/preset-env": "^7.14.2",

"@babel/preset-typescript": "^7.13.0",

"@testing-library/jest-native": "^4.0.1",

"@testing-library/react-native": "^7.2.0",

"add": "^2.0.6",

"babel-preset-react-native": "^4.0.1",

"jest": "^26.6.3",

"jest-fetch-mock": "^3.0.3",

"jest-junit": "^12.0.0",

"yarn": "^1.22.10"

},

Hey @vladimir.olishevsky, I was able to properly render an Image using the code you pasted above on both iOS and Android devices. One thing that may or may not be significant is you didn’t specify the size of the Image. component above. If thats the code you’re testing with, you’ll need to add the style property and specify the height and width.

Cheers,
Adam

Hello @adamjnav, thanks for you answer. But i solve my problem in another way. I write about it and may be it helps for someone. I saw that my images have path something like that
https://d1wp6m56sqw74a.cloudfront.net/~assets/67f58756f4007ef42cb53113b7604ad1
that means your images deploying and caching in remote servers, all your files have structure the same as it was when the command expo publish was entered. I forgot when i entered this command, may i never didn’t do this, but facts remain. It means also if you change directories of your images remote server will give you images with old path, and you need enter expo publish again if you want work correctly.

links help me

@adamjnav, may be you help me in moment, how i can return back path like src/path/to/image/ to my local file :slight_smile: or now it will always be so. thanks a lot

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.