6

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!

Iva
  • 2,447
  • 1
  • 18
  • 28
jotaro
  • 126
  • 5
  • Possible duplicate (also with no answers): https://stackoverflow.com/questions/66239089/react-native-0-63-4-ios-14-no-static-images – Kolby Aug 01 '21 at 15:50
  • Possible duplicate of (has an answer): https://stackoverflow.com/questions/35354998/react-native-ios-app-not-showing-static-assets-images-after-deploying/35366243#35366243 – Niraj Niroula Aug 02 '21 at 13:07
  • 1
    @Kolby, didn't find a solution, but I got a workaround, https://github.com/facebook/react-native/issues/31525#issuecomment-845345482 – jotaro Aug 02 '21 at 16:04
  • @NirajNiroula Thanks, but those answers and related to the previous missing image problem linked in the OP. – Kolby Aug 02 '21 at 16:45

1 Answers1

1

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.

Iva
  • 2,447
  • 1
  • 18
  • 28