我正在尝试使用 expo FileSystem 将 firebase 图像 URL 转换为 base64,但出现以下错误。
[未处理的承诺拒绝:错误:位置“https://pngimg.com/uploads/birds/small/birds_PNG108.png”不可读 - Expo React Native
URL 非常好,我可以在浏览器中打开它。我正在尝试以下 URL,并尝试了多个其他 URL。
https://pngimg.com/uploads/birds/small/birds_PNG108.png
以下是我的代码。
import * as FileSystem from 'expo-file-system';
<TouchableOpacity onPress={async () => {
const base64 = await FileSystem.readAsStringAsync('https://pngimg.com/uploads/birds/small/birds_PNG108.png', { encoding: 'base64' });
Share.share(
{
title: 'test title',
url: item.url,
},
{
excludedActivityTypes: [
],
}
);
}}>
</TouchableOpacity>
)}
在任何论坛上都找不到此问题的解决方案。
也许你应该使用
import * as Sharing from 'expo-sharing';
将图像临时保存在光盘上并使用 uri 共享图像。
than
import { Share} from 'react-native';
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)