react-native ListView - 我只需渲染DataSource中的一些对象

时间:2017-03-03 14:29:24

标签: listview react-native render

我在我的应用程序中使用ListView。 我想知道,有可能,不要在listView中渲染所有对象吗? 我的ListView工作正常。没有任何问题。我只是想停止渲染所有行。我可以使用注释行中的东西吗?

谢谢大家。

enter image description here

1 个答案:

答案 0 :(得分:4)

您需要在ListViewDataSource级别上执行此操作,而不是在渲染项目时执行此操作。只需在传递到ListView datasource属性之前对其进行过滤:

dataSource.cloneWithRows(items.filter((...) => 'your condition here'))