react-native iOS app not showing static assets (images) after deploying

前端 未结 5 1552
-上瘾入骨i
-上瘾入骨i 2020-12-01 12:58

I have all my static images in a folder called \"images\" in the root of my project. However, after I run the following command to bundle my app, the app works but no image

5条回答
  •  遥遥无期
    2020-12-01 13:16

    For a newer version of react-native use the following:

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

    You will see asset folder and main.jsbundle file in the ios folder. After that go to Xcode -> build phases -> copy bundle resources and then add the asset folder and main.jsbundle file. Don't forget to click on the Copy if needed

提交回复
热议问题