Permissions.askAsync hangs after function call

#1

Hi,

I’ve updated some times ago to the sdk 29, I’m using expokit with android and iOS. My app is already in production on sdk 27.

After the update, I’m running into a strange behavior regarding the permissions API on Android only.

I want to open the camera to take a picture so it’s quite a basic usage:

const gallery = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE)
const camera = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.CAMERA)
if (gallery === PermissionsAndroid.RESULTS.GRANTED && camera === PermissionsAndroid.RESULTS.GRANTED) {
   const result = await ImagePicker.launchCameraAsync({
             ...
   })
}

This code is throwing an error in sentry: User rejected permissions (from ImagePicker.launchCameraAsync)

If I use this code instead in order to ask permissions:

const gallery = await Permissions.askAsync(Permissions.CAMERA_ROLL)
console.log('test')
const camera = await Permissions.askAsync(Permissions.CAMERA)
console.log('ok')

The alert for the CAMERA_ROLL is displayed but the console.log is not.
I have to execute the function a second time to get the console.log and the second alert for the CAMERA only. And then once again to be able to display the console.log('ok') and execute the rest of the code.

Am I doing something wrong?

closed #2

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