Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native remove bottom space in Flatlist

I don't understand why my FlatList contain a space in the bottom like this: that's the space

Can anyone help me to remove the space? I have tried so many ways, but none of them are working. I also tried using ScrollView but the same problem occur. Here's my source code:

  <View
    style={{
      flex: 1,
      backgroundColor: 'red',
      justifyContent: 'center',
      alignItems: 'center',
    }}>
    <FlatList
      data={eventCategories}
      initialNumToRender={5}
      keyExtractor={item => item.id_event_category}
      showsHorizontalScrollIndicator={false}
      horizontal
      renderItem={renderCategories}
    />
    <View>
      <Text>Halo</Text>
      <Text>Halo</Text>
      <Text>Halo</Text>
      <Text>Halo</Text>
      <Text>Halo</Text>
      <Text>Halo</Text>
      <Text>Halo</Text>
      <Text>Halo</Text>
      <Text>Halo</Text>
    </View>
    <View style={styles.button}>
      <SmallButton
        title="Urutkan"
        icon="sort-active"
        onPress={() => setVisibleSort(true)}
      />
    </View>
  </View>

asa

like image 858
Ajeng Avatar asked Dec 05 '25 04:12

Ajeng


1 Answers

Didn't know why this issue occurs but temporary solution is wrap your FlatList with one different view with no style and main container should remain as same as it is.

<MainContainer>
    <View>
       <FlaList/>
    </View>
</MainContainer>
like image 172
Pankaj Kotwani Avatar answered Dec 06 '25 21:12

Pankaj Kotwani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!