React Native 如何解决Encounted two children with the same key,"::"....
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了React Native 如何解决Encounted two children with the same key,"::"....相关的知识,希望对你有一定的参考价值。
参考技术A 最近在开发React Native时使用FlatList构建列表,遇到一个报警如下:因为FlatList要求每一个FlatList的 items 有一个唯一的 key。
解决方法是在FlatList 使用 keyExtractor。 ReactNative 中文网提供了一个方法
在FlatList的keyExtrator属性中使用如下:
但是,引用后报了另一个警告
我把生成_keyExtractor
问题解决了。以上
如何解决在 react-native 开发模式下授予的覆盖权限需要?
【中文标题】如何解决在 react-native 开发模式下授予的覆盖权限需要?【英文标题】:How to resolve overlay permissions need granted in react-native dev mode? 【发布时间】:2019-07-03 05:04:12 【问题描述】:我已将我的 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
。
设备:华为 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"
【问题讨论】:
【参考方案1】:那行应该是这样的:
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
但通常情况下你不应该搞砸。
【讨论】:
【参考方案2】:Android oreo 是 only supported from RN 0.51 + ,更新你的 react native,最新版本是 0.58,新版本 0.59 会带 hooks 去 react native 7u7
【讨论】:
我会尝试升级。该应用是否仍可在 RN 0.51 + 上与以前的 Android 目标版本一起使用? 是的,我建议根据通过查看更改日志github.com/react-native-community/react-native-releases/blob/… 所做的更改来使用本机版本。一旦 0.59 出来,相信我,我正在切换到那个版本以上是关于React Native 如何解决Encounted two children with the same key,"::"....的主要内容,如果未能解决你的问题,请参考以下文章
如何解决在 react-native 开发模式下授予的覆盖权限需要?
使用“create-react-native-app myProject”命令时如何解决错误?
如何解决使用 react-native 构建 APK 时无法执行 aapt 的错误?