我最初使用此功能调整大小,然后在早期版本的Expo中上传图像,并且效果很好:
uploadImage = async (originalUri) => {
const { dispatchAvatar } = this.props;
const { uri } = await reduceImageAsync(originalUri);
const response = await fetch(uri);
const blob = await response.blob();
const photoData = { uri, blob };
dispatchAvatar(photoData);
};
但是,在Expo SDK36(RN 0.61.4)中,当我尝试获取uri时,响应返回为未定义。 uri只是一个本地文件(file:///),如果查看response.headers,我可以看到“ content-type”:“ image / jpeg”,因此访存可以正确识别该文件。 / p>
当我尝试记录响应时,我得到:
console.error: "There was a problem sending log messages to your development environment",
Error: value.hasOwnProperty is not a function. (In value.hasOwnProperty('tag')',
'value.hasOwnProperty' is undefined).
关于升级到Expo和React Native的较新版本的任何想法会破坏这一点吗?在iOS设备或模拟器上不起作用。
答案 0 :(得分:0)