react-native-qrcode-scanner icon indicating copy to clipboard operation
react-native-qrcode-scanner copied to clipboard

react-native-permissions: NativeModule.RNPermissions is null

Open BajajSaajan opened this issue 1 year ago • 6 comments

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

BajajSaajan avatar Mar 22 '23 09:03 BajajSaajan

Also getting this error.

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

webmonch avatar Mar 22 '23 12:03 webmonch

@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?

BajajSaajan avatar Mar 23 '23 06:03 BajajSaajan

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

zakharov-dy avatar Mar 24 '23 12:03 zakharov-dy

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.

ReddSpark1 avatar Apr 02 '23 13:04 ReddSpark1

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

Pankaj-R avatar Apr 06 '23 12:04 Pankaj-R

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!

cokron avatar Apr 19 '23 10:04 cokron