rnn
rnn

Reputation: 2553

How to convert ByteArray to Image in 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

Upvotes: 5

Views: 7451

Answers (1)

abhinandan sharma
abhinandan sharma

Reputation: 883

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}';

Upvotes: 9

Related Questions