jotaro
jotaro

Reputation: 186

Local image is not being rendered in release and TestFlight

Using react-native v0.63.4, and all the local image load fine in development mode

<Image
    source={require('../assets/images/xyz.png')}
    style={styles.img}
    resizeMode="cover"
/>

but once we built it in release mode or test flight, all the image loaded with require is not being rendered.

What I have found so far:

  1. Doesn't seem to be https://github.com/facebook/react-native/issues/29268, since I am using 0.63.4
  2. Examined the IPA file, and it does contain all the images

Thanks in advance!

Upvotes: 6

Views: 1372

Answers (1)

Iva
Iva

Reputation: 1524

This can be linking issue

In Build Phases > Bundle React Native code and images replace any lines you have for this:

export NODE_BINARY=node ../node_modules/react-native/scripts/react-native-xcode.sh

After that clean project, delete build folder and run following command

react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'

I hope this is helpful.

Also make sure your asset folder is there in Build Phases > Copy Bundle Resources.

Upvotes: 1

Related Questions