react-native: [Android] Vector images from native resources is not working
Based on React Native documentation, we should be able to fetch images from native resources.
This is works great on iOS, but in Android you can’t load vector images using uri
.
React Native version:
react-native: 0.61.5
Steps To Reproduce
Placing vector image named image.xml
in drawable
folder and using this code, is not working:
<Image width={100} height={100} source={{ uri: 'image' }} style={{ width: 100, height: 100 }} />
Placing the vector image in assets
folder and using this code, is not working either:
<Image width={100} height={100} source={{ uri: 'asset:/image.xml' }} style={{ width: 100, height: 100 }} />
Note that placing .jpg
or .png
images is working without any issues.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 10
- Comments: 15
This issue still exists in 0.68 (the originally reported issue, unrelated to splash screens).
I solved it, creating any other container for example Linear Layout and putting svg as background <LinearLayout android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_centerInParent = "true" android: background = "@ drawable / ic_splash_icon" android: orientation = "horizontal"> </LinearLayout> and works fine.
I´m using react-native-splash-screen for the splash flow
still exist in version 0.63.1