React-Native另一个支持VirtualizedList的容器 [英] React-Native another VirtualizedList-backed container

查看:451
本文介绍了React-Native另一个支持VirtualizedList的容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到反应本机0.61之后,我收到很多这样的警告:

After upgrading to react-native 0.61 i get a lot of warnings like that:

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

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

What is the other VirtualizedList-backed container that i should use, and why is it now advised not to use like that?

推荐答案

如果有人仍在寻找有关@Ponleu和@David Schilling在此处描述的问题的建议(关于FlatList上方的内容),则为我采取的方法:

If someone's still looking for a suggestion to the problem that @Ponleu and @David Schilling have described here (regarding content that goes above the FlatList), then this is the approach I took:

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

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

You can read more about this here: https://facebook.github.io/react-native/docs/flatlist#listheadercomponent

希望它能对某人有所帮助. :)

Hopefully it helps someone. :)

这篇关于React-Native另一个支持VirtualizedList的容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆