首页 > 解决方案 > React-Native 另一个 VirtualizedList 支持的容器

问题描述

升级到 react-native 0.61 后,我收到很多这样的警告:

VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead.

我应该使用的另一个VirtualizedList-backed container是什么,为什么现在建议不要那样使用?

标签: javascriptreactjsreact-native

解决方案


如果有人仍在寻找@Ponleu 和@David Schilling 在这里描述的问题的建议(关于 FlatList 之上的内容),那么这就是我采取的方法:

<SafeAreaView style={{flex: 1}}>
    <FlatList
      data={data}
      ListHeaderComponent={ContentThatGoesAboveTheFlatList}
      ListFooterComponent={ContentThatGoesBelowTheFlatList} />
</SafeAreaView>

您可以在此处阅读有关此内容的更多信息:https ://facebook.github.io/react-native/docs/flatlist#listheadercomponent

希望它可以帮助某人。:)


推荐阅读