javascript - 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 设备或模拟器。
解决方案
推荐阅读
- xslt - 如何从 xpath 列表创建合并的 xml 节点(或如何合并单个不一致的节点)
- laravel - 在 Homestead 中执行 NPM INSTALL 时出错
- python - 部署 Django 应用程序以呈现为静态站点
- python - 如何将行添加到将元组保持为元组而不是拆分为两个元素的数据框中?
- python - 测试失败,因为烧瓶正在返回 json 插入的流
- sql - 与第 1 列分组时,删除第 2 列中具有不同值的行
- python - 如何在不覆盖的情况下增加多个文件的文件名中的数字?
- git - GIT 保留分支特定文件 - 始终忽略特定文件
- installation - 在 Ubuntu 20.04.1 LTS 上安装 VirtualBox 的问题
- r - R嵌套JSON列表和非唯一名称的问题