Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert ByteArray to Image in react-native?

Tags:

react-native

Image comes to as ByteArray from webservice. I want to convert it to image. How do we do that ?

image comes like this :

enter image description here

like image 779
hhh Avatar asked Mar 28 '19 07:03

hhh


1 Answers

You can try this method:

var base64Image = 'data:image/png;base64,iVBORw0KGgoAAAANS...';
<Image style={{width: 50, height: 50}} source={{uri: base64Image}}/>

you can put base64 data after data:image/png;base64,. As Shown below

var base64Image = 'data:image/png;base64,{PLACE_YOUR_BASE64_DATA_HERE}';
like image 189
abhinandan sharma Avatar answered Nov 09 '22 11:11

abhinandan sharma