【问题标题】:react-native ListView - I need to render only some of the objects in the DataSourcereact-native ListView - 我只需要渲染 DataSource 中的一些对象
【发布时间】:2017-07-23 17:11:40
【问题描述】:

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

谢谢大家。

【问题讨论】:

  • 只需if(rowData === 'blabla') return <View/>

标签: listview react-native render


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2020-10-23
    • 2021-04-17
    • 1970-01-01
    • 2016-05-22
    • 1970-01-01
    • 2021-07-04
    • 2021-12-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多