Skip to content

Commit 5a976cd

Browse files
committed
update react-native from 0.7.1 to 0.17.0
fix warning: Each child in an array or iterator should have a unique "key" prop.
1 parent 4d92c06 commit 5a976cd

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

address_book/views/home.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,37 @@ var Home = React.createClass({
2020
var width = Math.floor(((Util.size.width - 20) - 50) / 4);
2121
var items = [
2222
{
23+
id:1,
2324
title: '研发',
2425
partment: '框架研发',
2526
color: '#126AFF',
2627
},
2728
{
29+
id:2,
2830
title: '研发',
2931
partment: 'BU研发',
3032
color: '#FFD600',
3133
},
3234
{
35+
id:3,
3336
title: '产品',
3437
partment: '公共产品',
3538
color: '#F80728',
3639
},
3740
{
41+
id:4,
3842
title: '产品',
3943
partment: 'BU产品',
4044
color: '#05C147',
4145
},
4246
{
47+
id:5,
4348
title: '产品',
4449
partment: '启明星',
4550
color: '#FF4EB9',
4651
},
4752
{
53+
id:6,
4854
title: '项目',
4955
partment: '项目管理',
5056
color: '#EE810D',
@@ -65,6 +71,7 @@ var Home = React.createClass({
6571
for(var i = 0; i < 4; i++){
6672
Items1.push(
6773
<ItemBlock
74+
key={items[i].id}
6875
title={items[i].title}
6976
partment={items[i].partment}
7077
width={this.state.width}
@@ -77,6 +84,7 @@ var Home = React.createClass({
7784
for(var i = 4; i < items.length; i++){
7885
Items2.push(
7986
<ItemBlock
87+
key={items[i].id}
8088
title={items[i].title}
8189
partment={items[i].partment}
8290
width={this.state.width}

address_book/views/home/address.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var Address = React.createClass({
2727
};
2828
for(var i in items){
2929
view.push(
30-
<View style={styles.row}>
30+
<View key={'addressItem' + i} style={styles.row}>
3131
<View style={[styles.text, color]}>
3232
<Text style={{fontSize:25, color:'#fff', fontWeight:'bold'}}>
3333
{items[i].username.substr(0, 1) || '未'}

address_book/views/manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var Manager = React.createClass({
2626
var JSXDOM = [];
2727
for(var i in items){
2828
JSXDOM.push(
29-
<TouchableOpacity onPress={this._loadPage.bind(this, components[i], items[i])}>
29+
<TouchableOpacity key={items[i]} onPress={this._loadPage.bind(this, components[i], items[i])}>
3030
<View style={[styles.item, {flexDirection:'row'}]}>
3131
<Text style={[styles.tag, {color: colors[i]}]}>{tags[i]}</Text>
3232
<Text style={[styles.font,{flex:1}]}>{items[i]}</Text>

address_book/views/manager/addUser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var AddUser = React.createClass({
4545
var tagOne = [];
4646
for(var i = 0; i <3; i++){
4747
tagOne.push(
48-
<TouchableOpacity onPress={this._select.bind(this, this.state.items[i])}>
48+
<TouchableOpacity key={this.state.items[i]} onPress={this._select.bind(this, this.state.items[i])}>
4949
<View style={[styles.part, this.state['select' + this.state.items[i]]]}>
5050
<Text style={this.state['select_' + this.state.items[i]]}>{this.state.tags[i]}</Text>
5151
</View>
@@ -56,7 +56,7 @@ var AddUser = React.createClass({
5656
var tagTwo = [];
5757
for(var i = 3; i <6; i++){
5858
tagTwo.push(
59-
<TouchableOpacity onPress={this._select.bind(this, this.state.items[i])}>
59+
<TouchableOpacity key={this.state.items[i]} onPress={this._select.bind(this, this.state.items[i])}>
6060
<View style={[styles.part, this.state['select' + this.state.items[i]]]}>
6161
<Text style={this.state['select_' + this.state.items[i]]}>{this.state.tags[i]}</Text>
6262
</View>

address_book/views/message.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ var Message = React.createClass({
3131
data={contents[i]}
3232
nav={this.props.navigator}
3333
component={Detail}
34+
key={contents[i].message}
3435
text={contents[i].message}
3536
name={contents[i].username}
3637
date={contents[i].time}/>

0 commit comments

Comments
 (0)