AbhinayMe
AbhinayMe

Reputation: 2547

'react-native-image-picker' allowing to choose images even after the Photo Library permission is declined

When "Photo Library" permission prompted & declined.

Still able to open library & choose images in iOS.

tested on iOS version: 15.5

dependencies used:

"react-native-image-picker": "^4.8.3"

Here is my code.

import { launchImageLibrary } from "react-native-image-picker";

launchImageLibrary(
        {
            mediaType: "photo",
            quality: 0.6,
            includeBase64: true
        },
        response => {
            console.log("Response = ", response);
            if (response.didCancel) {
                console.log("User cancelled image picker");
                alert("User cancelled image picker");
            } else if (response.errorCode) {
                console.log("ImagePicker ErrorCode: ", response.errorCode);
                alert("ImagePicker ErrorCode: " + response.errorCode);
            } else if (response.errorMessage) {
                console.log("ImagePicker ErrorMessage: ", response.errorMessage);
                alert("ImagePicker ErrorMessage: " + response.errorMessage);
            } else {
                let source = response;
                const uri = response?.assets && response.assets[0].uri;
                const base64 = response?.assets && response.assets[0].base64;
                const fileSize = response?.assets && response.assets[0].fileSize;
                console.log("uri: ", uri);
                console.log("base64: ", base64);
                console.log("fileSize: ", (fileSize / (1024 * 1024)).toFixed(2), "MB");
            }
        }
    );

Why is this happening? Does anyone successfully submitted & passed the AppStore review? Are there any chances of getting rejected?

Upvotes: 2

Views: 1482

Answers (1)

Ganesh Moorthy A
Ganesh Moorthy A

Reputation: 204

The permission is only for android, for IOS your method is correct, the app store will not reject your app. but in Android, your code does not work.

Upvotes: 0

Related Questions