React-Native Offline Bundle - Images not showing

前端 未结 3 793
感情败类
感情败类 2020-12-29 07:10

I have a React-Native app I\'m trying to deploy in Release mode to my phone. I can bundle the app to the phone. Database, Video and audio assets are all in there but no imag

相关标签:
3条回答
  • 2020-12-29 07:40

    When you are generating bundle , Also put --assets-dest ./

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

    It will generate main.jsbundle and Assets folder . Go to your Xcode right click add files to project and add main.jsbundle file to project. Also drag and drop Assets folder and select create by reference (note: do not select create group).

    i was using react 0.33, main.jsbundle is using assets(small a) folder but generating Assets(Caps A). I just changed the generated folder from Assets to assets and import it to xcode and it start working

    0 讨论(0)
  • 2020-12-29 07:43

    are the images in xcode or in the file system?, i dont see an --assets-dest in your bundle parameters

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

    also add the assets folder to xcode like the bundle.

    note that the image assets are only copied if they are required correctly, see the documentation

    0 讨论(0)
  • 2020-12-29 07:47

    Run this command in your Rn project root:

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

    And add reference of folder into your project in XCode.

    0 讨论(0)
提交回复
热议问题