I'm trying to display icons in a dynamic (react-native-elements) list from a DB via REST call which delivers the icon as base64 encoded string (i.e. here done with jHipster/swagger).
It has to work for both iOS and Android.
I thought this should be a quite common use case, but it turns out somewhat challenging...
What I tried so far:
- using
static addImageFromBase64(base64ImageData, success, failure)see here- works for iOS only (
@platform ios)
- works for iOS only (
- using 'data:' uri scheme like this example (as discussed here):
var base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANS ...
<Image source={{uri: base64Icon}} ... />
- the PR mentioned in that discussion was closed later, but somehow it seems that 'data:' scheme still was introduced, see RCTConvert.m, although it is not documented in Image
- but again it seems it was implemented only for iOS (only in the .m file)
- Looking at Image for Android, it seems that rendering is delegated to the native side and this could be the reason why it was not implemented for Android (at least it does not work for me in Android).
So is there any good way to get a base64 image string into an Android react-native app?
Or is there a good practice or library to solve this (getting icons dynamically from a DB via REST API into a react-native app) in a complete different way?
urion Android? It works when I test it on my device.