Skip to content
This repository has been archived by the owner on May 12, 2023. It is now read-only.

react-native-permissions: NativeModule.RNPermissions is null #411

Open
BajajSaajan opened this issue Mar 22, 2023 · 6 comments
Open

react-native-permissions: NativeModule.RNPermissions is null #411

BajajSaajan opened this issue Mar 22, 2023 · 6 comments

Comments

@BajajSaajan
Copy link

I want to integrate this package only in android. While integration i am getting this error as below, kindly assist.

If you are using CocoaPods on iOS, run pod install in the ios directory and then clean, rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.
• If you are getting this error while unit testing you need to mock the native module. You can use this to get started: https://github.com/react-native-community/react-native-permissions/blob/master/mock.js

@webmonch
Copy link

Also getting this error.

react-native-permissions is set up correctly. I use them in the same project and everything is ok.

@BajajSaajan
Copy link
Author

@mmvlad I tried. as per the documentation
npm install react-native-permissions --save
react-native link react-native-permissions

Is there anything i am missing?

@zakharov-dy
Copy link

One of the typical solutions for such a case is to override dependencies. Override the react-native-permissions dependency for react-native-qrcode-scanner. For npm we need to use overrides, and for resolutions for yarn.

So for this code works just delete node_modules folder, yarn.lock file, and add this code to package.json

  "resolutions": {
    "react-native-permissions": "^3.8.0"
  },
  "overrides": {
    "react-native-qrcode-scanner": {
      "react-native-permissions": "^3.8.0"
    }
  },

https://stackoverflow.com/questions/75772965/error-react-native-permissions-nativemodule-rnpermissions-is-null

@ReddSpark1
Copy link

I'm still having this issue. I tried deleting the react-native-qrcode-scanner\node_modules folder,. Then added the code above to the package.json file of my app. This however then gives me RNPermissionsModule' could not be found. And I have also been getting Invariant Violation: "main" has not been registered.

@Pankaj-R
Copy link

Pankaj-R commented Apr 6, 2023

Just upgrade your "react-native-permissions" library to "3.6.0", and the issue will removed. I was facing this with my Camera and "react-native-qrcode-scanner" lib.Thanks

@cokron
Copy link

cokron commented Apr 19, 2023

The solution provided by @zakharov-dy worked for me. I love react-native-qrcode-scanner. This issue is annoying, it took me an hour to find this solution, so dear @moaazsidat if you could fix this, it would be great and probably help many people! Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants