you need to put Text tag inside a View Tag and also keyExtractor
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View, FlatList, Image, ScrollView, Picker } from 'react-native';
export default class Test extends Component {
constructor() {
super();
this.state = {
data : [
{"Begin" : "08:00:00" ,End : "08:10:00"},
{"Begin" : "08:10:00" ,End : "08:20:00"},
{"Begin" : "08:20:00" ,End : "08:30:00"},
{"Begin" : "08:30:00" ,End : "08:40:00"},
{"Begin" : "08:40:00" ,End : "08:50:00"},
{"Begin" : "08:50:00" ,End : "08:60:00"},
]
}
}
_keyExtractor = (item, index) => item.Begin.toString();
render() {
return (
<View style={{flex:1,justifyContent:'center'}}>
<FlatList
data={this.state.data}
keyExtractor={this._keyExtractor}
renderItem={({item}) => <Text> {item.Begin} </Text> }
/>
</View>
)
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.