Can't see image on my device

Hello,
I built a simple app with react-native.
I’ve added an image to the main screen of the app.
I run the xcode simulator and can see the image in the app.
After running “exp build:ios” and uploading the app to Appstore with Application Loader,
I can’t see the image in Testflight on my device.

Any idea how to solve it?

Hey @talmor,

Can you share the relevant code to the Image component that is not being rendered?

It’s hard to help debug without any code to look at.

Cheers,

Adam

Thanks for your reply.

Here is the code:
<Image source={require(‘/img/BabyButton.png’)}/>

and I have a folder “img” which includes the files:
BabyButton.png, BabyButton@2x.png, BabyButton@3x.png

I’m having the same issue on my iOS device when making a release build, in development everything works fine, but the release build shows no images.

Using as simple as <Image source={require(‘/some/path/to/image.png’)} />

This issue happened only after upgrading to v29 of expo, v28 and former versions worked fine

Hey @talmor and @jper92,

How are you guys handling your assets? Are you doing asset bundling or are you fetching them from the CDN? If the later, how are you loading them?

Cheers,

Adam

HI @adamjnav, thanks, in my case I’m bundling my assets by adding a build phase which ends up executing

PATH="$PATH:$value" exp bundle-assets --platform ios --dest "$dest"

I don’t know if this is working correctly because I don’t know how to debug it, should my code also cache the assets?

Edit: I’ve tried caching my assets using Asset.loadAsync([some-assets]) but had the same result

When I fetch it from the CDN, it works well.
I’d like to bundle the assets - how should I do it? (I run exp build:ios for building the app)

Hey @talmor,

Here’s the docs for bundling assets: https://docs.expo.io/versions/v28.0.0/guides/offline-support#bundle-your-assets-inside-your-standalone-binary

I’m a bit confused on your last post, so when you fetch them from the CDN, the image displays? If so, what were you doing when the image doesn’t display?

@jper92, hmmm if your bundling your assets that shouldn’t be an issue. As long as your assets are in explicitly required, they will be uploaded to the CDN and should be able to be fetched. Will have to investigate this further.

I thought the same, but the images most of the time won’t show with or without bundle, with or without caching. I even tried to undetach and detach again hoping it to be some wrong setup but it behaves the same. Also I made sure the images are explictly required as stated in the react native guide. Temporarily I’m sticking to v28

Edit: I think this issue is describing the same https://github.com/expo/expo/issues/2112

I’ve already included this in app.json:

“expo”: {

1 Like

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