FlatList的最后一项从底部开始修剪

问题描述 投票:1回答:1

我正在显示带有可变项目数的FlatList,并且最后一个项目始终不完全可见(边框底部)。

enter image description here

render()

render() {
    return (
      <View style={styles.container}>
        <FlatList style={styles.list} containContainerStyle={{paddingBottom: 20}}
          ...
        />
      </View>
    );
  }

CSS

container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: 'white'
  },
list: {
   flex: 1,
   width: "95%"
}
css reactjs react-native styling react-native-flatlist
1个回答
2
投票

您为平面列表使用了错误的样式属性,它是contentContainerStyle而不包含containerStyle。您将不得不根据商品的大小来增加它。

<FlatList contentContainerStyle={{ paddingBottom: 20}} />
© www.soinside.com 2019 - 2024. All rights reserved.