React Native FlatList with other Component doesn't scroll to the end
Wrap Flatlist
with style={{flex:1}}
. If it does not work add marginBottom
to flatlist
<View style={{flex:1}}>
<FlatList
data={this.props.produk}
renderItem={({ item }) =>
<View key={item.id} >
<Image resizeMode="cover" source={{ uri: item.thumb }} style={styles.fotoProduk} />
</View>
}
keyExtractor={(item, index) => index}/>
</View>
I had the same issue. I was trying to add padding to the top which caused the rest of the content to be pushed down. You need to set the contentContainerStyle
prop to modify this correctly and then set all the remaining styles on the style
prop of the FlatList
. Example:
<FlatList
style={{
flex: 1
}}
contentContainerStyle={{
paddingTop: 40
}}
data={this.props.produk}
renderItem={({ item }) => (
<View key={item.id}>
<Image
resizeMode="cover"
source={{ uri: item.thumb }}
style={styles.fotoProduk}
/>
</View>
)}
keyExtractor={(item, index) => index}
/>
Adding style={{flex:1}} in View.
In FlatList add contentContainerStyle={{ paddingBottom: 10}}. Check the example code:
<View style={{flex:1}}> <FlatList contentContainerStyle={{ paddingBottom: 10}} renderItem={({ item }) => return(console.log(item)) } /> </View>