ReactNativeiOS(三)开发零碎3 warning: Each child in ar array or integrator should have a unique "key" prop
来源:互联网 发布:mac 网游 编辑:程序博客网 时间:2024/05/02 01:04
原为:
render() {
return (<ScrollView style={styles.container}>
<View style={styles.imageGrid}>
{ this.state.images.map((image) => {
return (
<TouchableHighlight onPress={this.selectImage.bind(null, image.uri)}>
*/
{ this.state.images.map((image, i) => {
return (
<TouchableHighlight key={i} onPress={this.selectImage.bind(null, image.uri)}>
<Image style={styles.image} source={{ uri: image.uri }} />
</TouchableHighlight>
);
})
}
</View>
</ScrollView>
);
}
出了个Warning: Each child in ar array or integrator should have a unique "key" prop
查了半天,在这里似乎得到答案 http://stackoverflow.com/questions/28329382/understanding-unique-keys-for-array-children-in-react-js
改为:
render() {
return (<ScrollView style={styles.container}>
<View style={styles.imageGrid}>
{ this.state.images.map((image, i) => {//此处加了 ,i)
return (
<TouchableHighlight key={i} onPress={this.selectImage.bind(null, image.uri)}>//此处加了 key={i}
<Image style={styles.image} source={{ uri: image.uri }} />
</TouchableHighlight>
);
})
}
</View>
</ScrollView>
);
}
warning 消失,,,yeah!
0 0
- ReactNativeiOS(三)开发零碎3 warning: Each child in ar array or integrator should have a unique "key" prop
- Warning: Each child in an array or iterator should have a unique "key" prop.
- Warning: Each child in an array or iterator should have a unique "key" prop. Check the render ...
- react Warning: Each child in an array or iterator should have a unique "key" prop. Check the render
- Warning: Each child in an array or iterator should have a unique "key" prop. Check the render ...
- react-native中debug报错信息:Each child in an array or iterator should have a unique "key" prop.
- React总结7:Each child in an array or iterator should have a unique "key" prop.的处理方法
- ant-design Warning: Each record in table should have a unique `key` prop,or set `rowKey` to an un
- ReactNativeiOS(三)开发零碎2 DatePickerIOS propType warning 4个
- ReactNativeiOS(三)开发零碎4 Image 2 Base64
- ReactNativeiOS(三)开发零碎1 Fetch错误Network request failed
- Each module has to have a unique path
- Have a first child
- Should new index columns be in the key, or included?
- 三维数组按key排序 Sorting a 3-dimensional array by a key in PHP
- Mysql error 1452 - Cannot add or update a child row: a foreign key constraint fails
- MySQL ERROR 1452 - Cannot add or update a child row: a foreign key
- Mysql error 1452 - Cannot add or update a child row: a foreign key constraint fails
- FileNet5.2.1 新建Component queue及在流程中使用Component节点
- shell脚本编程<一>:变量及脚本中数学计算
- WCF初见
- 欢迎使用CSDN-markdown编辑器
- 基于图像的三维重建系统概览
- ReactNativeiOS(三)开发零碎3 warning: Each child in ar array or integrator should have a unique "key" prop
- python递归深度报错--RuntimeError: maximum recursion depth exceeded
- 2015年广工操作系统实验(要求实现图形化界面)
- Codeforces 610D Vika and Segments 【线段树扫描线 求面积并】
- 安装CocoaPods遇到的问题及解决办法
- (Windows)Web服务器架设(Apache+Tomcat+php+JSP)
- Jfinal—悄悄走近你
- shell修改配置文件
- Codevs_P1033 蚯蚓的游戏问题(拆点网络流+最小费用流)