Я вручную ввел ключ, который идентичен в db.json, хотя он показывает ту же ошибку
Я пытался добавить уникальные ключи вручную в db.json, даже если ошибка отражается в том же самомпуть.В чем ошибка в этом коде, чтобы я мог переписать его.Я не могу определить в чем ошибка?
const styles = StyleSheet.create({
list: {
flex: 1,
paddingTop: 20,
backgroundColor: '#A9A9A9'
},
});
class EventList extends Component {
state = {
notes: []
}
componentDidMount() {
const notes = require('./db.json').notes;
this.setState({ notes });
}
render() {
return [
<FlatList
key="flatlist"
style={styles.list}
data={this.state.notes}
renderItem={({ item, seperators }) => (<EventCard notes={item} />)}
keyExtractor={item => item.id}
/>,
// <View style={{ flex: 1, backgroundColor: '#f3f3f3' }}>
<ActionButton buttonColor="rgba(231,76,60,1)">
<ActionButton.Item buttonColor='#9b59b6' title="New Task" onPress={() => this.props.navigation.navigate('form')}>
<Icon name="md-create" style={styles.actionButtonIcon} />
</ActionButton.Item>
<ActionButton.Item buttonColor='#1abc9c' title="All Tasks" onPress={() => console.log("Hi")}>
<Icon name="md-done-all" style={styles.actionButtonIcon} />
</ActionButton.Item>
<ActionButton.Item buttonColor='#00FF00' title="Camera" onPress={() => { }}>
<Icon name="md-camera" style={styles.actionButtonIcon} />
</ActionButton.Item>
</ActionButton>
// </View>
];
}
}
var style = StyleSheet.create({
actionButtonIcon: {
fontSize: 20,
height: 22,
color:'#FF0000',
opacity: 0,
},
});
export default EventList;
This is my db.json file and I have written unique Id. I am getting a warning saying that each child should have a unique key. Here are my 2 files.
{
"events":[
{
"name":"chandu",
"date":"15-06-2018 ",
"content":"How are you..?",
"id":"05dafc66-bd91-43a0-a752-4dc40f039144"
},
{
"name":"bread",
"date":"15-07-2018 ",
"content":"I bought bread..?",
"id":"05dafc66-bd91-43a0-a752-4dc40f039145"
},
{
"name":"bharath",
"date":"15-06-2018 ",
"content":"I bought milk..?",
"id":"05dafc66-bd91-43a0-a752-4dc40f039146"
},
{
"name":"george",
"date":"20-06-2018 ",
"content":"I am eating",
"id":"05dafc66-bd91-43a0-a752-4dc40f039147"
},
{
"name":"michael",
"date":"15-09-2018 ",
"content":"I bought yogurt..?",
"id":"05dafc66-bd91-43a0-a752-4dc40f039198"
},
{
"name":"vick",
"date":"15-04-2018 ",
"content":"I bought milk..?",
"id":"05dafc66-bd91-43a0-a752-4dc40f039157"
},
{
"name":"shaun",
"date":"09-06-2018 ",
"content":"I bought milk..?",
"id":"05dafc66-bd91-43a0-a752-4dc40f039120"
}
]
}