Base64
转换为blob
,可以使用以下方法:
安装下面的包
npm install buffer --save
首先将您的Base64
编码转换为字节数组
import { Buffer } from "buffer";
const base64 = 'iVBORw0KGgoAAAANSUhEU ....'
let your_bytes = Buffer.from(base64, "base64");
const blob = new Blob([your_bytes], { type: 'YOUR TYPE' })
react-native-version
版本?const url = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA...';
const getBlob = async (uri) => {
const res = await fetch(uri);
return res.blob();
};
const blob = await getBlob(url);
应该可以工作
JavascriptCore
差异。请在此处阅读https://reactnative.dev/docs/javascript-environment - Pasindu Dilshan