Home > Mobile >  Not receiving callback in fragment for camera permission request only when integrated in a React Nat
Not receiving callback in fragment for camera permission request only when integrated in a React Nat

Time:08-25

I have created a Fragment that has a WebView. It receives a permission request via the website for resources (camera access). After checking permission status locally, ActivityResultLauncher’s object is received as a return value from the registerActivitForResult method at the start of the fragment. Its launch method is called and it works well and permission dialog opens but the callback for registerActivityForResult is not getting called when the user "allows" the permission.

The most important part is: that it doesn’t work only when this fragment is added as a React Native Component via createViewManager as defined on React Native docs. What’s weird is it works perfectly fine if it is used natively and is added directly on MainActivity of a native android app.

CodePudding user response:

It seems to be an issue with React Native if you are using androidx Fragment. Try using Fragment from app.fragment and Permission API's will work with react native.

  • Related