Home > Mobile >  How to reset Camera Permission in expo-image-picker?
How to reset Camera Permission in expo-image-picker?

Time:09-09

I have just started to use expo-image-picker but for testing purposes I have denied the camera permissions so many times that I'm not being asked anymore whether I want to allow or deny the permission. I have refreshed, relaunched the app but nothing to do

Sample.js

import {TouchableOpacity} from "react-native";
import React from "react";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
import FontAwesome5 from "react-native-vector-icons/FontAwesome5";
import * as ImagePicker from "expo-image-picker";
  
  const Sample = ({ navigation }) => {
  
    const handleUpload = async () => {
      let permissionResult =
        await ImagePicker.requestMediaLibraryPermissionsAsync();
      console.log(permissionResult);
      if (permissionResult.granted === false) {
        alert("Camera access required");
        return;
      }
    };
  
    return (
      <KeyboardAwareScrollView>
          <TouchableOpacity onPress={handleUpload}>
            {image && image.url && (
              <FontAwesome5
                name="camera"
                size={20}
                color="black"
                style={{ marginTop: -20, marginLeft: 200, marginBottom: 30 }}
              />)}
          </TouchableOpacity>
      </KeyboardAwareScrollView>
    );
  };
  
  export default Sample ;

CodePudding user response:

Go to the respective app settings and clear data. It should most likely reset the permissions. You can also try uninstalling the app and reinstalling it.

If you are inquiring about what to do if a user does so (which most likely they won't), you'll have to direct the user to the app's settings page and manually allow the permissions.

CodePudding user response:

You'll need to uninstall and reinstall to receive this prompt again I believe.

  • Related