【问题标题】:flatlist extends out of the screenflatlist 延伸到屏幕之外
【发布时间】:2021-01-07 10:25:16
【问题描述】:

我的屏幕如下所示:

return (
    <SafeAreaView style={styles.safeAreaViewContainer}>
      <View style={styles.container}>
       ....
        <View style={styles.listContainer}>
          {data && showFlatList !== null && (
            <UsersFoundList
              data={data}
            />
          )}
        </View>
      </View>
    </SafeAreaView>
  );
};

  listContainer: {
    justifyContent: 'center',
    //marginBottom: 50,
  },

我在这里从 UserFoundList 组件调用一个 FlatList:

  return (
    <View>
      <FlatList
        data={data.user}
        horizontal={false}
        scrollEnabled
        renderItem={({ item }) => (
          <UserFoundEntry user={item} onSendRequest={onSendRequest} />
        )}
        keyExtractor={(item) => item?.id?.toString()}
        ListEmptyComponent={NoUsersFoundTextBox}
      />
    </View>
  );
};

但列表与底部的 safeAreaView 重叠。滚动时,它应该出现在 SafeAreaView 的后面/下方,而不是在它的顶部。

【问题讨论】:

  • 可以提供list Container的样式吗?

标签: javascript css typescript react-native react-native-flatlist


【解决方案1】:

尝试在 listContainer 样式中使用flex: 1,这应该使其保持在父视图的边界内。

【讨论】:

    猜你喜欢
    • 2012-06-22
    • 2013-05-08
    • 2017-04-12
    • 2018-08-12
    • 2017-09-10
    • 1970-01-01
    • 1970-01-01
    • 2015-10-18
    • 1970-01-01
    相关资源
    最近更新 更多