1

I have an Expo project with an <Image /> component sourced from an import:

import logoImage from './assets/logo-medium.png';

...

<Image source={logoImage} />

This works fine on my device when building with expo run:ios -d. However, when I build the project with XCode, the image isn't there, and I see this error:

[native] Could not find image file:///Users/username/Library/Developer/CoreSimulator/Devices/B76D59AF-9599-4174-991B-AE484575B79C/data/Containers/Data/Application/A57C6E10-3DF9-46E0-8B56-7760AF5199C6/Library/Application%20Support/.expo-internal/assets/assets/logo-medium.png

When I try to find that file manually, there is no ...Application Support/.expo-internal directory.

Is there a different way I should be specifying image location? Or a way for the image to be correctly bundled when building from XCode?

T3db0t
  • 3,491
  • 4
  • 28
  • 45

1 Answers1

5

I had the same issue, make sure about two things:

  1. One of the potential solutions found on the web - https://forums.expo.dev/t/assets-missing-only-in-ios-release-build-after-ejecting/42759
Ok I found out the problem.
When ejecting, expo is supposed to generate a metro.config.js file that looks like that:

module.exports = {
  transformer: {
      assetPlugins: ['expo-asset/tools/hashAssetFiles']
  }
};
  1. Your metro.config.js file shuld has .js extensions not .ts
r1skz3ro
  • 66
  • 3
  • A million thanks, this appears to have worked! I now have my image back. – T3db0t Jan 13 '22 at 14:47
  • Thank you so much for the answer, my production build keeps being blank when upgrading from SDK 41 to 47, this really solved my issue! – Tyson Z Jul 25 '23 at 09:52