Skip to content

usePermission does not update state when permission is granted on mobile #2628

@callmekatootie

Description

@callmekatootie

What is the current behavior?

My code:

const state = usePermission({ name: "camera: })

console.log(state) // One of prompt, granted or denied

This works fine on desktop - when user grants permission, the state updates from prompt to granted. However, on google chrome mobile the state does not update.

Steps to reproduce it and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have extra dependencies other than react-use. Paste the link to your JSFiddle or CodeSandbox example below:

Just try the usePermission hook with camera on google chrome mobile - you will see the bug/

What is the expected behavior?

The state should update to granted on mobile too

A little about versions:

  • OS: iOS
  • Browser (vendor and version): Google Chrome
  • React: 18.3
  • react-use: 17.6
  • Did this worked in the previous package version? Didn't check

This could be due to limited support of Permission API in google chrome mobile - in which case would like to know a workaround

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions