When user denies access to camera roll, the camera roll still launch

Please provide the following:

  1. SDK Version: 39.0.3
  2. Platforms(Android/iOS/web/all): Android/iOS

When a user wants to change the account profile picture and denies the app access to the gallery the app still launches the gallery for the user to select a picture. Below is my function

const selectPicture = async () => {
    await Permissions.askAsync(Permissions.CAMERA_ROLL);
    let result = await ImagePicker.launchImageLibraryAsync({
      mediaTypes: ImagePicker.MediaTypeOptions.All,
      allowsEditing: true,
      aspect: [4, 3],
      quality: 1,
    });

    if (!result.cancelled) handleInput("image", result.uri);
  };

Hey @vokenad, are you testing this within the Expo client or as a standalone app?

Cheers,
Adam

I’m testing with the Expo client, working with managed workflow.

@adamjnav Solution?

This is my solution, I had to check the permission request before calling the ImagePicker.

const selectPicture = async () => {
    const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
    if (status !== "granted") {
      Alert.alert(
        "Kiwi",
        "Grant Kiwi access to camera roll to upload your picture."
      );
    } else {
      let result = await ImagePicker.launchImageLibraryAsync({
        mediaTypes: ImagePicker.MediaTypeOptions.All,
        allowsEditing: true,
        aspect: [4, 3],
        quality: 1,
      });

      if (!result.cancelled) handleInput("image", result.uri);
    }
  };

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.