React Native ios not showing local image

Viewed 11044

Environment

  • macOS : 10.14.6
  • Xcode : 11.0
  • react : 16.8.6
  • react-native : 0.60.5
  • project folder structure : google drive image link

Background

I made a simple app. I tested it on Android/iOS simulator and real device. It worked well all. Now I'm trying to deploy on App Store.

Problem

I changed the build scheme on Xcode from debug to release ( product -> scheme -> edit scheme -> run -> build configuration ). And I run it on simulator. And result was this(google drive image link).

I don't know why my app cannot load static image. If I changed the scheme to debug it shows well like this(google drive image link).

Maybe...?

  1. I got this error /Users/mac88/Desktop/Projects/팀포크봇/VoiceCarRN/ios/main.jsbundle: No such file or directory after I remove main.jsbundle file in ios folder.
  2. 2019-10-13 02:09:06.046867+0900 VoiceCarRN[44601:3301900] [PERF ASSETS] Loading image at size {854, 1334}, which is larger than the screen size {750, 1334}

Check please !

5 Answers

After you create the jsbundle and assets folder using this command

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

you will have to include both of them in Copy Bundle Resources step in Build Phases, since you are running the app in release configuration.

use this commmad in inside project to copy assert from app to ios folder

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

please install react-native cli for running above command.

for this warning

Loading image at size {854, 1334}, which is larger than the screen size {750, 1334}

just add resizeMode: 'contain' in image style

add/modify this command in your package.json file

“build:ios”: “react-native bundle --entry-file=‘index.js’ --bundle-output=‘./ios/main.jsbundle’ --assets-dest ./ios/release --dev=false --platform=‘ios’”

The real cause was index .tsx file.

I'm using typescript, and I used index.tsx.

I changed index.tsx to index .js and the image shows up correctly !

Related