Byeongin Yoon
Byeongin Yoon

Reputation: 4027

React Native ios not showing local image

Environment

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 !

Upvotes: 2

Views: 12987

Answers (5)

Afzal Ali
Afzal Ali

Reputation: 1056

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’”

Upvotes: 1

Anhdevit
Anhdevit

Reputation: 2104

I think it is an issue of your xcode version. So try to update xcode 11.7 and don't use Beta version to build React Native. I have same issue with you because I use Xcode 12 https://developer.apple.com/forums/thread/652406

Upvotes: 0

Byeongin Yoon
Byeongin Yoon

Reputation: 4027

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 !

Upvotes: 1

Kaushik
Kaushik

Reputation: 981

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.

Upvotes: 2

Aurangzaib Rana
Aurangzaib Rana

Reputation: 4252

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

Upvotes: 1

Related Questions