expo: expo-image-picker not working on Android only

πŸ› Bug Report

Environment

Expo CLI 3.0.9 environment info: System: OS: macOS 10.14.6 Shell: 5.3 - /bin/zsh Binaries: Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node Yarn: 1.16.0 - ~/.nvm/versions/node/v10.15.3/bin/yarn npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm IDEs: Xcode: 11.1/11A1027 - /usr/bin/xcodebuild npmPackages: @bugsnag/expo: ^6.4.0 => 6.4.0 expo: ^34.0.1 => 34.0.4 react: 16.8.3 => 16.8.3 react-native: https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz => 0.59.8 react-navigation: ^3.11.1 => 3.12.1 npmGlobalPackages: expo-cli: 3.0.9

Steps to Reproduce

Add an await ImagePicker.launchImageLibraryAsync on Android and it will fail to return after picking an image.

Note - this happens on ImagePicker.launchCameraAsync as well

Expected Behavior

Expected permissions to be granted and then Picker Result to output the selected file after chosen.

Actual Behavior

The picker opens, file is selected, then no response as a return from the await ImagePicker.launchImageLibraryAsync.

Per the example below, the output ends after the permissions output:

Permissions: Object {
  "expires": "never",
  "permissions": Object {
    "camera": Object {
      "expires": "never",
      "status": "granted",
    },
    "cameraRoll": Object {
      "expires": "never",
      "status": "granted",
    },
  },
  "status": "granted",
}

Reproducible Demo

Here’s the code that I’m running:

handlePickImage = async () => {
    try {
      const res = await Permissions.askAsync(
        Permissions.CAMERA,
        Permissions.CAMERA_ROLL
      )
      console.log("Permissions:", res)

      let result = await ImagePicker.launchImageLibraryAsync({
        mediaTypes: ImagePicker.MediaTypeOptions.All,
        allowsEditing: false,
        aspect: [4, 3]
      })

      console.log("Picker Result", result)

      if (!result.cancelled) {
        const { session } = this.props
        this.handleSend([
          {
            _id: Math.random(),
            user: { _id: session.user.id },
            image: result.uri
          }
        ])
      }
    } catch (err) {
      console.log("ERR", err)
    }
  }

Add a button anywhere that has an onPress={this.handlePickImage}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Thanks for your help @lukmccall, it seems to be an issue on my side. Closing until it happens again in a more reproducible way.