I'm trying to run a react-native app in Xcode simulator, But the app not showing assets(images) so I tried this: XCode project -> Build Phases -> Copy Bundle Resources, then adding assets to my Copy Bundle Resources. When I do this the app turns to blank white page,this issue is a duplicate of this I want to know why this solution didn't work for me? and what can I do to solve it? note: i can see images in android simulator
Asked
Active
Viewed 1,785 times
0
-
What do you mean he doesn't show his assets? Show me the code. – hong developer Sep 03 '19 at 13:37
-
i mean i can't see images in IOS, but it's works perfectly in Android. looks like react-native can't read images from src folder (just in IOS) when i run it in android emulator i can see images... – Kamal Cherkaoui Sep 03 '19 at 15:35
1 Answers
0
For images included via Xcode asset catalogs or in the Android drawable folder, use the image name without the extension:
<Image source={{ uri: 'app_icon' }} style={{ width: 40, height: 40 }} />
For images in the Android assets folder, use the asset:/
scheme:
<Image source={{ uri: 'asset:/app_icon.png' }} style={{ width: 40, height: 40 }} />

hong developer
- 13,291
- 4
- 38
- 68
-
I checked it, but seems this isn't my issue, I think I have the same case in this link: https://stackoverflow.com/questions/35354998/react-native-ios-app-not-showing-static-assets-images-after-deploying but none of the answers works for me – Kamal Cherkaoui Sep 03 '19 at 16:49
-
@KamalCherkaoui If you are saving it to the Relative Native Image folder, you can use it without saving it to the set of Xcode . – hong developer Sep 04 '19 at 00:44