I was originally using this function to resize and then upload an image in an earlier version of Expo and it worked fine:
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);
};
In Expo SDK36 (RN 0.61.4) however, when I try to fetch the uri, the response returns as undefined. The uri is just a local file (file:///), and if I look at response.headers, I can see the "content-type": "image/jpeg", so the fetch is recognizing the file correctly.
When I try to log the response, I get:
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).
Any ideas what about upgrading to the newer version of Expo and React Native would have broken this? Doesn't work on an iOS device or the simulator.
按照此处更新的示例进行操作,效果很好: https : //github.com/expo/examples/blob/master/with-firebase-storage-upload/App.js
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.