[Unhandled promise rejection: Error: Location "imageURL" isn't readable - Expo React Native
[Unhandled promise rejection: Error: Location "imageURL" isn't readable - Expo React Native
我正在尝试使用 expo FileSystem 将 firebase 图像 URL 转换为 base64,但出现以下错误。
[Unhandled promise rejection: Error: Location "https://pngimg.com/uploads/birds/small/birds_PNG108.png" isn't readable - 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 共享图像。
比
import { Share} from 'react-native';
我正在尝试使用 expo FileSystem 将 firebase 图像 URL 转换为 base64,但出现以下错误。
[Unhandled promise rejection: Error: Location "https://pngimg.com/uploads/birds/small/birds_PNG108.png" isn't readable - 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 共享图像。
比
import { Share} from 'react-native';