简体   繁体   中英

Local Images (as assets) not Loading in iOS; Expo EAS Build (React Native)

I have used several icons in the application, but they are not loading in iOS build, but load perfectly fine in Android build. The icons been used are PNG files in local assets folder. I have tried to use different methods to include Image files;

  1. var chevron_right = require('./chevron-right.png');
  2. import chevron_right from './chevron-right.png';
  3. Third that I used was to put a JS file (ie Icons.js) in the folder where there the images are and than export those images from it. Like: export default { chevron_right: require('./chevron-right.png') } and then import where I want Like: import Icons from './path/to/icons' <Image source={Icons.chevron_right} style={{ height: 8, width: 8 }} />

All of the above three methods do not work for iOS builds. The screenshots are attached, the versions of expo and react native are: Expo CLI: 0.60, Expo SDK: 46, React: 18, React Native: 0.69.4

Screenshots :

iOS 截图

安卓屏幕截图

The error seems to be with the Xcode. So pls Follow this React-native iOS not showing images (pods issue) . Read the full thread.

The question is answered.(Regards)

I updated my EAS CLI from 0.60 to 1.1.1, now my Images are rendering in iOS build.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM