I had an app built with Expo 49, the local images and expo-vector icons were displayed just fine using Image from expo-image.
Suddenly, after migrating to expo 51, all the local images and icons stopped showing up on both Android and IOS.
As for the icons, I switched to lucide-react-native, and that resolved the problem.
For the images, in my app.json file, I added the expo-asset plugin to load the images at build time.
{
"expo": {
"plugins": [
[
"expo-asset",
{
"assets": ["./assets/images/google.png"]
}
]
]
}
}
This fixed the issue on IOS after running npx expo run:ios.
However, on Android the issue persists. Local images are not displayed.
Here are my project’s dependencies:
"dependencies": {
"@babel/runtime": "^7.25.4",
"@expo/config-plugins": "~8.0.0",
"@expo/prebuild-config": "~7.0.0",
"@expo/vector-icons": "^14.0.2",
"@gorhom/bottom-sheet": "^4.5.1",
"@react-native-async-storage/async-storage": "1.23.1",
"@react-native-community/netinfo": "11.3.1",
"@react-native/assets-registry": "^0.74.83",
"@react-navigation/material-top-tabs": "^6.6.13",
"@shopify/flash-list": "1.6.4",
"@tanstack/react-query": "^5.40.0",
"algoliasearch": "^4.24.0",
"axios": "^1.7.2",
"babel-plugin-module-resolver": "^5.0.2",
"cloudinary-react-native": "^1.0.0",
"dayjs": "^1.11.12",
"deprecated-react-native-prop-types": "^5.0.0",
"expo": "^51.0.31",
"expo-asset": "~10.0.10",
"expo-auth-session": "~5.5.2",
"expo-av": "~14.0.6",
"expo-constants": "~16.0.2",
"expo-crypto": "~13.0.2",
"expo-dev-client": "~4.0.26",
"expo-device": "~6.0.2",
"expo-font": "~12.0.10",
"expo-image": "~1.12.15",
"expo-image-picker": "~15.0.7",
"expo-linear-gradient": "~13.0.2",
"expo-linking": "~6.3.1",
"expo-localization": "~15.0.3",
"expo-notifications": "~0.28.15",
"expo-router": "~3.5.23",
"expo-secure-store": "~13.0.2",
"expo-splash-screen": "~0.27.5",
"expo-status-bar": "~1.12.1",
"expo-tracking-transparency": "~4.0.2",
"expo-web-browser": "~13.0.3",
"graphql": "^16.9.0",
"i18next": "^23.11.5",
"lottie-react-native": "6.7.0",
"lucide-react-native": "^0.435.0",
"mime": "^4.0.3",
"punycode": "^2.3.1",
"react": "18.2.0",
"react-content-loader": "^6.2.1",
"react-hook-form": "^7.48.2",
"react-i18next": "^14.1.2",
"react-instantsearch-core": "^7.12.4",
"react-native": "0.74.5",
"react-native-bouncy-checkbox": "^3.0.7",
"react-native-calendars": "^1.1302.0",
"react-native-gesture-handler": "~2.16.1",
"react-native-google-places-autocomplete": "^2.5.6",
"react-native-maps": "1.14.0",
"react-native-markdown-display": "^7.0.2",
"react-native-pager-view": "6.3.0",
"react-native-reanimated": "~3.10.1",
"react-native-safe-area-context": "4.10.5",
"react-native-screens": "3.31.1",
"react-native-svg": "15.2.0",
"react-native-tab-view": "^3.5.2",
"react-native-toast-message": "^2.2.0",
"react-native-web": "~0.19.10",
"vexo-analytics": "^1.3.16",
"zustand": "^4.5.2"
}
I tried to use useAssets from ‘expo-asset’ in order to load the images at runtime:
import { Asset, useAssets } from 'expo-asset'
const GetStarted = () => {
const [img, error] = useAssets([
require('../assets/hero_section_img.png'),
require('../assets/google.png'),
])
...
However I’m getting the following error on both IOS and Android:
TypeError: Cannot read property 'uri' of null
When I run “npx expo-doctor@latest”, only one check is filling:
“Check that native modules use compatible support package versions for installed Expo SDK”.
Here is the warning:
Expected package @expo/config-plugins@~8.0.0
Found invalid:
@expo/[email protected]
That’s because of the cloudinary-react-native package that I’m using.
But I don’t think that is the issue, because I tried to remove that package, delete package-lock.json and rebuild the project, and that didn’t help.
Removing node_modules and package-lock.json didn’t help neither.