i send the data from the backen and want to show some of the items on the flatlist the flatlist render all the data i want to render the latest 3 items
FlatList
<FlatList
data={props.data}
disableVirtualization={false}
keyExtractor={item => item.key}
snapToInterval={90}
decelerationRate='fast'
renderItem={({item}) =>{
return(
<View style={{height: 100, width: 350}}>
<View style={globalStyles.transactionContainer}>
<Text style={globalText.h3}>{item.type}</Text>
<Text style={globalText.h3}>{item.amount}</Text>
</View>
</View>
)}}
/>
</View>
>Solution :
try this:
<FlatList
data={props.data.slice(0, 3)}
inverted
disableVirtualization={false}
keyExtractor={item => item.key}
snapToInterval={90}
decelerationRate='fast'
renderItem={({item}) =>{
return(
<View style={{height: 100, width: 350}}>
<View style={globalStyles.transactionContainer}>
<Text style={globalText.h3}>{item.type}</Text>
<Text style={globalText.h3}>{item.amount}</Text>
</View>
</View>
)}}
/>
I add inverted prop and add a slice on you data