I've forked a repo and want to get it running, it's a react app that I'm running in Android Studio. I've tried starting the app on an emulator and on the browser and I'm getting the same error:
index.ts:6 Uncaught Error: react-native-permissions: NativeModule.RNPermissions is null. To fix this issue try these steps:
• 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
I'm trying to start the app on Android and I'm not running any tests. I start the app with yarn start
. This is my package.json:
{
"name": "my-app",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "expo start --dev-client",
"start-native": "react-native run-ios",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web"
},
"dependencies": {
"@expo/webpack-config": "^0.17.0",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1",
"@fortawesome/react-native-fontawesome": "^0.3.0",
"@react-native-community/netinfo": "^9.3.7",
"@react-native-picker/picker": "^1.8.3",
"@react-navigation/native": "^6.0.13",
"@react-navigation/native-stack": "^6.9.0",
"deprecated-react-native-prop-types": "^4.0.0",
"expo": "~46.0.9",
"expo-modules-autolinking": "^0.10.3",
"expo-splash-screen": "~0.16.2",
"expo-status-bar": "~1.4.0",
"jwt-decode": "^3.1.2",
"moment": "^2.29.4",
"moment-countdown": "0.0.3",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "^0.69.5",
"react-native-camera": "^4.2.1",
"react-native-paper": "^5.0.0-rc.6",
"react-native-permissions": "3.6.1",
"react-native-picker-select": "^8.0.4",
"react-native-progress": "^5.0.0",
"react-native-qrcode-scanner": "^1.5.5",
"react-native-safe-area-context": "^4.3.4",
"react-native-screens": "^3.17.0",
"react-native-svg": "^13.6.0",
"react-native-svg-uri": "^1.2.3",
"react-native-web": "~0.18.7"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
I realize there are other posts about this however so far I have not been able to figure it out. Here are the things that I've tried so far:
- I've added the following line to
my-app/android/app/src/main/AndroidManifest.xml
:
<uses-permission android:name="android.permission.CAMERA" />
Removing and reinstalling
node_modules
&yarn.lock
...several times!Changing the version of
react-native-permissions
from 3.8.0 to 3.6.1I ran
yarn add pod-install
...I don't believe I should have to do this because I'm completely on Andriod at the moment.I ran
yarn add react-native-cli
andyarn react-native link react-native-permissions
. I get a message saying thatlink
is not a recognised command. After some googling, I'm seeing that autolinking should mean I don't have to run this command manually, however, I'm unsure if this is still the case when I'm usingreact-native-qrcode-scanner
.