【问题标题】:react native horizontal flatlist not scrolling反应原生水平平面列表不滚动
【发布时间】:2021-06-02 23:03:28
【问题描述】:

我有一个水平平面列表,但它没有滚动

我还不知道原因

有人可以帮我吗?

              <FlatList
                data={dashboardData}
                contentContainerStyle={{
                  width: '100%',
                  paddingHorizontal: 30,
                  flex: 1,
                }}
                keyExtractor={key => key}
                renderItem={renderItem}
                horizontal
                showsHorizontalScrollIndicator={false}
              />

【问题讨论】:

  • 你将宽度 100% 设置为 contentContainerStyle(这是内部容器的样式),将使内部容器的宽度 = 容器的宽度。

标签: arrays react-native react-native-flatlist flatlist


【解决方案1】:

contentContainerStyle 更新为,

...
contentContainerStyle={{
  //Remove `flex: 1` and `width` property, that will wrap all of the child views.
  paddingHorizontal: 30,
}}
...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-06
    • 2018-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多