How to resolve overlay permissions need granted in react-native dev mode? - react-native

I've changed my Android device from Android 7.0 to Android 8.0 to run a react-native app on. Previously adding the overlay permission in AndroidManifest allowed the app to run and display the developer menu on the device:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.simpleoffsetpro"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission tools:node="remove" android:name="android.permission.SYSTEM_ALERT_WINDOW" />
</manifest>
But when I run the app on Android 8.0 I grant the permission that's prompted "Permit drawing over other apps". Then the app just shows a grey screen with notification - Overlay permissions needs to be granted in order for react native apps run in dev mode.
Device: Huawei P Smart - Android 8.0.0
Question:
How can you resolve overlay permissions needs to be granted in react-native dev mode?
Package.json depedencies:
"dependencies": {
"bluebird": "^3.3.5",
"convert-units": "^2.3.4",
"event-emitter": "^0.3.4",
"immutability-helper": "^2.8.1",
"immutable": "^3.7.6",
"lodash": "^4.11.0",
"moment": "^2.12.0",
"native-base": "2.0.12",
"react": "~15.4.2",
"react-dom": "~15.4.2",
"react-native": "0.42.0",
"react-native-awesome-alerts": "^1.0.6",
"react-native-dismiss-keyboard": "^1.0.0",
"react-native-floating-label-text-input": "^0.1.4",
"react-native-hide-with-keyboard": "^1.0.0",
"react-native-keyboard-listener": "^1.1.0",
"react-native-localization": "^1.0.11",
"react-native-material-initials": "^0.0.12",
"react-native-overlay": "^0.5.0",
"react-native-popup-menu": "^0.12.3",
"react-native-swiper": "^1.5.13",
"react-native-vector-icons": "^4.0.0",
"react-redux": "^4.4.5",
"redux": "^3.4.0",
"redux-logger": "^2.6.1",
"redux-loop-symbol-ponyfill": "^2.2.0",
"redux-promise": "^0.5.3",
"redux-thunk": "^2.0.1",
"standard-http-error": "^2.0.0"
},
"devDependencies": {
"babel-core": "^6.9.0",
"babel-eslint": "^7.1.0",
"babel-jest": "^17.0.2",
"babel-polyfill": "^6.9.0",
"babel-preset-react-native": "^1.9.0",
"babel-preset-stage-0": "^6.5.0",
"babel-register": "^6.9.0",
"enzyme": "^2.2.0",
"eslint": "^3.10.1",
"eslint-plugin-babel": "^3.2.0",
"eslint-plugin-react": "^6.7.1",
"fetch-mock": "^5.5.0",
"istanbul": "1.0.0-alpha.2",
"jasmine": "^3.1.0",
"jest": "^17.0.2",
"react-addons-test-utils": "~15.4.2",
"react-native-mock": "~0.2.5",
"react-test-renderer": "^16.3.2",
"remote-redux-devtools": "^0.5.7",
"rimraf": "^2.5.2"
}

Android oreo is only supported from RN 0.51 + , update your react native, the latest version is 0.58, and the new version 0.59 is gonna bring hooks to react native 7u7

That line should look like this:
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
But it's not normally something you should have to mess with.

Related

#babel/preset-typescript can not be found after upgrading React Native from 0.67.4 to 0.68.0

After upgrading React Native from 0.67.4 to 0.68.0 on Big Sur, react-native run-android shows a red screen on android studio 2021.1.1 Patch 2 emulator after launch. And can not find #babel/preset-typescript.
error: node_modules/react-native-gesture-handler/src/handlers/gestures/GestureDetector.tsx: /Users/macair/Documents/code/js/xyz_app6/node_modules/react-native-gesture-handler/src/handlers/gestures/GestureDetector.tsx: Cannot find module '#babel/preset-typescript'
Require stack:
- /Users/macair/Documents/code/js/xyz_app6/node_modules/#babel/core/lib/config/files/plugins.js
- /Users/macair/Documents/code/js/xyz_app6/node_modules/#babel/core/lib/config/files/index.js
- /Users/macair/Documents/code/js/xyz_app6/node_modules/#babel/core/lib/index.js
- /Users/macair/Documents/code/js/xyz_app6/node_modules/metro-transform-worker/src/index.js
- /Users/macair/Documents/code/js/xyz_app6/node_modules/metro/src/DeltaBundler/Worker.js
- /Users/macair/Documents/code/js/xyz_app6/node_modules/jest-worker/build/workers/processChild.js
BUNDLE ./index.js
Here is the screen shot:
Here is the portion of package.json:
"dependencies": {
"#ethersproject/shims": "^5.6.0",
"#react-native-community/toolbar-android": "^0.2.1",
"#react-native-masked-view/masked-view": "^0.2.6",
"#react-native-picker/picker": "^2.4.0",
"#react-navigation/native": "^6.0.8",
"#react-navigation/stack": "^6.1.1",
"crypto-js": "^4.1.1",
"ethers": "^5.6.1",
"react": "17.0.2",
"react-native": "0.68.0",
"react-native-blob-util": "^0.14.1",
"react-native-confirmation-code-field": "^7.3.0",
"react-native-device-info": "^8.5.1",
"react-native-easy-grid": "^0.2.2",
"react-native-elements": "^3.4.2",
"react-native-encrypted-storage": "^4.0.2",
"react-native-flash-message": "^0.2.1",
"react-native-gesture-handler": "^2.3.2",
"react-native-get-random-values": "^1.7.2",
"react-native-gifted-chat": "^0.16.3",
"react-native-image-picker": "^4.7.3",
"react-native-loading-spinner-overlay": "^3.0.0",
"react-native-modal": "^13.0.1",
"react-native-reanimated": "^2.5.0",
"react-native-redash": "^16.2.3",
"react-native-responsive-screen": "^1.4.2",
"react-native-safe-area-context": "^4.2.2",
"react-native-screens": "^3.13.1",
"react-native-vector-icons": "^9.1.0",
"rn-alioss": "^0.2.5",
"socket.io-client": "^4.4.1"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "7.14.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.2",
"react-test-renderer": "17.0.2"
},
I can yarn add #babel/preset-typescript -D but is there way to fix the error without explicitly adding #babel/preset-typescript?

Google Play store rejects a react native app due to ‘non certified ad SDK’, how to resolve this?

Our simple app, which streams YouTube video content, has been rejected by the Google Play Store due to usage of a 'non certified ads SDK'. However, we have not used any ads sdk in the app.
Any idea on how to fix this?
Here is the list of dependencies.
{
"#react-native-community/async-storage": "^1.5.0",
"axios": "^0.19.0",
"deprecated-react-native-listview": "^0.0.5",
"prop-types": "^15.7.2",
"react": "16.8.3",
"react-native": "0.59.9",
"react-native-cached-image": "^1.4.3",
"react-native-fetch-blob": "^0.10.8",
"react-native-firebase": "^5.5.4",
"react-native-gesture-handler": "^1.3.0",
"react-native-orientation": "^3.1.3",
"react-native-pdf": "^5.1.3",
"react-native-rate": "^1.1.7",
"react-native-searchbar": "^1.16.0",
"react-native-sentry": "^0.43.2",
"react-native-silent-switch": "thejump/react-native-silent-switch",
"react-native-simple-store": "^2.0.0",
"react-native-vector-icons": "^6.4.2",
"react-native-view-pdf": "^0.8.6",
"react-native-webview": "^5.11.0",
"react-native-whc-loading": "^1.0.3",
"react-native-youtube": "GroupXTech/react-native-youtube",
"react-navigation": "^3.6.0",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-persist": "^5.10.0",
"redux-saga": "^1.0.2",
"reduxsauce": "^1.0.1"
}

The experience you requested uses Expo SDK v(null), but this copy of Expo Client requires at least v35.0.0

I decided to return to an Expo app I was developing last year and was using expo-sdk:v33.0.0 and it was working.
I tried to use a solution of Squirrl from similar question, but still no luck. Tried removing node_modules and yarn_install. Here's my package.json:
enter
"dependencies": {
"#react-native-community/masked-view": "^0.1.7",
"#react-navigation/material-bottom-tabs": "^5.1.1",
"#react-navigation/material-top-tabs": "^5.1.1",
"#react-navigation/native": "^5.0.9",
"#react-navigation/stack": "^5.2.3",
"axios": "^0.18.1",
"date-fns": "^1.29.0",
"dotenv": "^8.2.0",
"expo": "^33.0.0",
"expo-font": "~5.0.1",
"lodash": "^4.17.15",
"native-base": "^2.13.1",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
"react-native-gesture-handler": "~1.2.1",
"react-native-modal": "^11.5.4",
"react-native-paper": "^3.6.0",
"react-native-platform-touchable": "^1.1.1",
"react-native-reanimated": "1.0.1",
"react-native-safe-area-context": "^0.7.3",
"react-native-safe-area-view": "^1.0.0",
"react-native-status-bar-height": "^2.1.0",
"react-native-tab-view": "^2.13.0",
"react-native-vector-icons": "^5.0.0",
"react-redux": "^5.1.0",
"redux": "^4.0.1",
"redux-axios-middleware": "^4.0.0",
"redux-persist": "^5.10.0",
"save": "^2.4.0",
"victory-native": "^30.6.0"
"devDependencies": {
"babel-preset-expo": "^5.0.0",
"nodemon": "^2.0.2",
"react-native-dotenv": "^0.2.0"
The app was working with these dependencies that time.
1st issue is that error says Expo SDK v(null). But version is specified in both package.json and app.json.
2nd issue is error says Expo client requires v35.0.0. How can i run the app without upgrading sdk from v33 to v35
This is what worked for me.
Run npm i -g expo-cli (You may have to use sudo if on a Mac. I did.) then run expo upgrade
Follow the prompts and it should work.

Aws-amplify not working with react-native and expo version 36.0.0

I'm currently working on a react-native-app using expoSdk which is supposed to run on web,ios and android. The most challenging part till now has been to setup the navigation which I finally did. Now I added amplify to my project but the project stops working whenever I run it on any mobile device but it works just fine on web. The error I receive is
NetInfo has been removed from React Native
After a lot of trial and error I discovered that the error comes from aws-amplify since it seems to still run with reac-native-community/netinfo. The error only occours when I import something from amplify. I found this in
node_modules\#aws-amplify\core\lib\Util\Reachability.native.js
Deo anyone know how I can resolve this issue?
Here is my package.json if needed
"dependencies": {
"#expo/vector-icons": "~10.0.0",
"aws-amplify": "^2.2.6",
"#react-native-community/masked-view": "0.1.5",
"#react-navigation/bottom-tabs": "^5.0.0",
"#react-navigation/drawer": "^5.2.0",
"#react-navigation/native": "^5.0.0",
"#react-navigation/stack": "^5.0.0",
"#react-navigation/web": "~1.0.0-alpha.9",
"expo": "~36.0.0",
"expo-asset": "~8.0.0",
"expo-constants": "~8.0.0",
"expo-font": "~8.0.0",
"expo-web-browser": "~8.0.0",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"react-native-gesture-handler": "~1.5.0",
"react-native-reanimated": "^1.7.0",
"react-native-safe-area-context": "0.6.0",
"react-native-screens": "2.0.0-alpha.12",
"react-native-web": "~0.11.7",
"react-spring": "^8.0.27",
"styled-components": "^5.0.1",
"#aws-amplify/api": "^2.1.6",
"#aws-amplify/pubsub": "^2.1.7",
"#expo/samples": "^3.0.3",
"apollo-boost": "^0.4.3",
"apollo-cache-inmemory": "^1.6.2",
"apollo-client": "^2.6.3",
"apollo-link-http": "^1.5.15",
"aws-amplify-react-native": "^3.2.2",
"aws-appsync": "^1.7.0",
"aws-appsync-react": "^1.2.5",
"expo-av": "~8.0.0",
"expo-camera": "~8.0.0",
"expo-file-system": "~8.0.0",
"expo-image-picker": "~8.0.1",
"expo-permissions": "~8.0.0",
"graphql-tag": "^2.10.1",
"moment": "^2.20.1",
"prop-types": "^15.7.2",
"react-apollo": "^2.0.4",
"react-native-datepicker": "^1.7.2",
"react-native-deck-swiper": "^1.6.7",
"react-native-keyboard-aware-scroll-view": "^0.9.1",
"react-native-material-dropdown": "^0.11.1",
"react-native-modal": "^11.3.1",
"react-native-modal-datetime-picker": "^4.13.0",
"react-native-modal-dropdown": "^0.6.2",
"react-native-paper": "^2.16.0",
"react-native-responsive-screen": "^1.4.0",
"react-native-segmented-control-tab": "^3.4.1",
"react-native-slideable-calendar-strip": "^0.4.0",
"react-native-snap-carousel": "^3.8.0",
"react-native-sound": "^0.11.0",
"react-native-svg": "9.13.3",
"react-native-swipe-gestures": "^1.0.3",
"react-native-swipeable": "^0.6.0",
"react-native-swipeout": "^2.3.3",
"react-native-touchable-swipe": "^1.0.0",
"react-navigation": "^4.2.2",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-persist": "^4.10.2",
"redux-thunk": "^2.3.0",
"uuid": "^3.2.1"
},
Any help is much appreciated thanks.
Incase someone has this issue this is the solution by #Ashish-Nanda on github:
The issue you linked has a reply from the package maintainer with the reason for the error.
It is likely that one or more of your dependencies is importing NetInfo from React Native core. Looking at your package.json, one of these would be aws-appsync-react where you will need to upgrade to any version above 2.x.x. Remove both aws-appsync-react and aws-appsync from your package.json and install the latest versions (ensure its above 2.x.x). And then do:
npm install --save #react-native-community/netinfo#4.7.0
You need to install this specific version because newer versions cause issues as the API changed.

undefined is not an object (evaluating 'viewConfig.Manager')

Im trying to upgrade expo sdk from version 33 to 34 and getting undefined is not an object (evaluating 'viewConfig.Manager') inside react-native package
package.json
"date-fns": "^2.0.1",
"eslint-plugin-react-hooks": "^1.7.0",
"expo": "^34.0.1",
"expo-analytics-amplitude": "~5.0.1",
"expo-asset": "^5.0.1",
"expo-constants": "^6.0.0",
"expo-font": "~5.0.1",
"expo-intent-launcher": "^6.0.0",
"expo-keep-awake": "~5.0.1",
"expo-linear-gradient": "~5.0.1",
"expo-localization": "~5.0.1",
"expo-location": "^5.0.1",
"expo-permissions": "^6.0.0",
"expo-yarn-workspaces": "^1.1.0",
"i18n-js": "3.2.2",
"pomeranian-durations": "^1.8.1",
"prop-types": "15.7.2",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"react-native-app-intro-slider": "^3.0.0",
"react-native-gifted-chat": "0.9.0",
"react-native-keyboard-spacer": "^0.4.1",
"react-navigation": "^3.9.1",
"react-redux": "6.0.1",
"redux": "^4.0.1",
"redux-devtools-extension": "2.13.8",
"redux-logger": "3.0.6",
"redux-optimist": "^1.0.0",
"redux-sentry-middleware": "^0.1.1",
"redux-persist": "6.0.0",
"redux-thunk": "2.3.0",
"sentry-expo": "2.0.0",
"styled-components": "^4.2.0",
"synced-interval": "^0.2.0"
I was struggling with the same issue for the last two hours.
In my case there were some outdated libraries (including one I authored) using the old version of react-native which somehow causes this error.
Try running:
npm outdated
And then install new versions of outdated libraries listed using expo-cli one by one.
Hope this helps :)