react-nativereact-native-image-picker

react-native-image-picker response.uri is undefined


In my react-native app, I using react-native-image-picker to pick image from camera or gallery. But the resource.uri returned in undefined in both launchCamera and launchImageLibrary. What am I doing wrong?

Here is my github repo of a basic build of the react-native app. The image picker code is in addProductScreen.js


Solution

  • I saw your problem and I have a solution for you. the response is a JSON object that contains an array called assets so you can access your image url by using this.

    response.assets[0].uri