reactjs - React Native 删除 Flatlist 中的底部空间

我不明白为什么我的 FlatList 在底部包含一个空格,如下所示: that's the space

谁能帮我去掉空格?我尝试了很多方法,但都没有用。我也尝试使用 ScrollView 但同样的问题发生了。这是我的源代码:

  <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>

作为

最佳答案

不知道为什么会出现此问题,但临时解决方案是用一个没有样式的不同 View 包装您的 FlatList,并且主容器应保持原样。

<MainContainer>
    <View>
       <FlaList/>
    </View>
</MainContainer>

https://stackoverflow.com/questions/63031909/

相关文章:

c - 用C写的小程序

perl - 使用 sed 或 perl 替换两个字符之间的多个字符

python - 属性错误 : 'list' object has no attribute 'en

javascript - 如何为 Angular Material Slide Toggle 设置默

reactjs - 避免在组件加载时对组件使用多个 useEffect

javascript - 将变量传递给自定义 Svelte Web 组件

javascript - 在嵌套导航器中导航时未定义 route.params?

python - GoogleTrans Python 不翻译

r - 拆分字符串、标记子字符串并将标记转换为数字向量

python - pandas Groupby 求和并连接