首页 > 解决方案 > Expo SDK36 RN 0.61.4 中的提取返回未定义

问题描述

我最初使用这个函数来调整大小,然后在早期版本的 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”,因此 fetch 正确识别了文件。

当我尝试记录响应时,我得到:

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 设备或模拟器。

标签: javascriptreact-nativeexporeact-native-ios

解决方案



推荐阅读