Closed BagasNS closed 1 year ago
oops some mistake made by me
async function getCameraAndroid(params: PermissionParamsType) {
const checkResult = await check(PERMISSIONS.IOS.CAMERA); // this is wrong, it must be PERMISSIONS.ANDROID.CAMERA
if (checkResult !== 'denied') {
return checkResult;
}
let rationale: Rationale = {
title: params.title,
message: params.message,
buttonPositive: 'Izinkan',
buttonNegative: 'Jangan Izinkan'
}
return request(PERMISSIONS.ANDROID.CAMERA, rationale)
}
Bug summary
im using real device Samsung S23 FE (Android 13) first try request permission running smoothly, after a while method
check()
always return unavailable but when i try request permission wihoutcheck()
it running well, doescheck()
method really important? here is my sample codeif i comment check method it running well
already run ./gradlew clean, uninstall app on real device, re-run metro bundler with --reset-cache, issue still presist
Library version
3.10.0
Environment info
Steps to reproduce
Reproducible sample code
Permissions.ts
async function getCameraIOS(params: PermissionParamsType) { const checkResult = await check(PERMISSIONS.IOS.CAMERA); if (checkResult !== 'denied') { return checkResult; }
let rationale: Rationale = { title: params.title, message: params.message, buttonPositive: 'Izinkan', buttonNegative: 'Jangan Izinkan' }
return request(PERMISSIONS.ANDROID.CAMERA, rationale) }
async function getCameraAndroid(params: PermissionParamsType) { const checkResult = await check(PERMISSIONS.IOS.CAMERA); if (checkResult !== 'denied') { return checkResult; }
let rationale: Rationale = { title: params.title, message: params.message, buttonPositive: 'Izinkan', buttonNegative: 'Jangan Izinkan' }
return request(PERMISSIONS.ANDROID.CAMERA, rationale) }
<Pressable onPress={async () => { // Check Permission const permissionCamera = await getCamera({ title: 'Akses Kamera Dibutuhkan', message: 'Izinkan akses kamera agar kamu dapat mengambil gambar dengan kamera' }); console.log(permissionCamera) }}