Спасибо попробую разобраться, у меня именно сложность в том что, добавляется title. Пробовал с flatlist. Там делал следующим образом componentDidMount(){
fetch("
http://10.0.2.2:8080/api/values/entity/5")
.then(response => response.json())
.then((responseJson)=> {
this.extractData(responseJson);
})
.catch(error=>console.log(error)) //to catch the errors if any
}
extractData(responseJson) {
let arr = [{},{},{},{},{}]
for (let i=0;i<responseJson.length;i++)
{
let dbObj=responseJson[i];
let num= dbObj.entity;
if(!arr[num])
{
arr[num]={};
}
if(dbObj.attribute==22)
{
arr[num].name=dbObj.value;
}
if(dbObj.attribute==18)
{
arr[num].date = dbObj.value;
}
if(dbObj.attribute==19)
{
arr[num].time=dbObj.value;
}
if(dbObj.attribute==20)
{
arr[num].location=dbObj.value;
}
if(dbObj.attribute=21)
{
arr[num].haill=dbObj.value;
}
if(dbObj.attribute=23)
{
arr[num].discipline_name=dbObj.value;
}
}
console.log(JSON.stringify(arr));
this.setState({
dataSource: arr,
});
}
render() {
return (
<View style={styles.container} >
<Text style={styles.h2text}>
Shedule
</Text>
<FlatList
data={this.state.dataSource}
showsVerticalScrollIndicator={false}
renderItem={({item}) =>
<View style={styles.flatview}>
<Text style={styles.value}>{
item.date}</Text>
<Text style={styles.value}>{
item.name}</Text>
<Text style={styles.value}>{item.time}</Text>
<Text style={styles.value}>{item.location}</Text>
<Text style={styles.value}>{item.haill}</Text>
<Text style={styles.value}>{item.discipline_name}</Text>
</View>
}
/>
</View>
);
}
}