Convert base64 string to image in react native

前端 未结 1 1527
孤街浪徒
孤街浪徒 2021-01-05 06:33

Problem

I created a social media app with expo\'s react native, and wanted to add the ability to upload images. Since expo won\'t let you convert

1条回答
  •  心在旅途
    2021-01-05 07:11

    You can do this:

    var base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANS...';
    
    

    In the base64Icon variable you need to put your base64 data after data:image/png;base64,. Like this:

    var base64Icon = 'data:image/png;base64,{PLACE_YOUR_BASE64_DATA_HERE}';
    

    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题