I am trying to ask user for permission to camera and photos. Even though i looped two request permission calls it shows popup for one an then closes.
Then I have to click on the same button and it asks for the second permission.
How can i get to show multiple permissions in a loop?
+1
@sahil290791 did you ever solve this problem?
@mbenjamin618 No, was unable to find a solution.
Faced the same issue.
I think that the documentation is outdated.
In ReactNativePermissions.js there is not method 'check', use getPermissionStatus
getPermissionStatus(permission, type) {
if (this.getPermissionTypes().indexOf(permission) >= 0) {
return RNPermissions.getPermissionStatus(permission, type)
} else {
return Promise.reject(`ReactNativePermissions: ${permission} is not a valid permission type on ${Platform.OS}`)
}
}
@alex-nask - check is the new method name in version 1.0.0. I'll be pushing it to NPM shortly.
@sahil290791 - looping should work, can you share the code that you tried?
I tried something like this, and it seemed to work...
Permissions.request("location")
.then(locationResponse => {
console.log("location permission: " + locationResponse);
return (Permissions.request("camera"));
}).then(cameraResponse => {
console.log("camera permission: " + cameraResponse);
return (Permissions.request("photo"));
}).then(photoResponse => {
console.log("photo permission: " + photoResponse);
});
closing for inactivity
Most helpful comment
I tried something like this, and it seemed to work...