I've issue with rendering my array json data in FlatList component. I've searched lots of documentation and information through web and stackoverflow. Here is a couple of links of webpages that I've looked. But I couldn't figure it out.
Here is my code;
//Creating array for map the each item in places.
let array = [];
//Initializing the data to array for mapping it. data1 is my json data.
array.push(data1);
flatList = <FlatList
style={{ backgroundColor: 'red' }} // backgroundColor is visible but no List Component data in it.
data={array}
keyExtractor={(x, i) => i.toString()}
renderItem={({item}) => {
<List
district = {item.a.b.c.jsonArray[0].address}
phoneNumber = {item.a.b.c.jsonArray[0].phoneNumber}
neighbourhood = {item.a.b.c.jsonArray[0].sideInformation}
/> // nothing returns as <List />
}}
/>;
Here is my return statement;
return (
<View style={{ flex: 1 }} >
<TopBar
name={"title"}
bColor={"#1b92e7"}
miniLogo={require('../../../assets/pictures/image.png')}
/>
<List></List>
<List></List>
{flatList}
</View>
);
In return statement it is rendering those two component but in the flatList variable it is not rendering . What is causing the problem? I hope you guys can help me?
I appreciate your efforts lots of thanks.
component standalone visible in return statement but when trying to render in flatList it is not showing my
but backgroundColor is also visible. – tron Nov 20 '18 at 08:32