Fetch in Expo SDK36 RN 0.61.4 returns as undefined

patdugan :

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.

patdugan :

Followed the updated example here and it worked fine: https://github.com/expo/examples/blob/master/with-firebase-storage-upload/App.js

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=21857&siteId=1