如何解决在React-native开发人员模式下需要授予的覆盖权限?

时间:2019-02-08 22:33:35

标签: react-native android-permissions android-8.0-oreo

我已将Android设备从Android 7.0更改为Android 8.0,以在其上运行react-native应用程序。之前在AndroidManifest中添加了叠加权限,该应用才能运行并在设备上显示开发者菜单:

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

但是,当我在Android 8.0上运行该应用程序时,我授予了提示“允许在其他应用程序上绘制”的权限。然后,该应用仅显示带有通知-Overlay permissions needs to be granted in order for react native apps run in dev mode的灰屏。

设备:Huawei P Smart-Android 8.0.0

问题:

如何解决需要在react-native开发人员模式下授予的叠加权限?

Package.json漏洞:

"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"
  }

enter image description here

2 个答案:

答案 0 :(得分:1)

Android oreo是only supported,来自RN 0.51 +,更新您的react native,最新版本是0.58,新版本0.59会带来钩子来响应native 7u7

答案 1 :(得分:0)

该行应如下所示:

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

但这通常不是您应该惹的祸。