【问题标题】:react-native SectionList scrollToreact-native SectionList scrollTo
【发布时间】:2017-11-12 07:43:27
【问题描述】:

我是 react-native 的新手,并尝试使用 SectionList。到目前为止,一切正常。但是,我似乎无法使用 facebook 文档中定义的 scrollToLocation 函数。有人尝试过使用它或类似的东西吗?基本上,我想滚动到特定的部分和项目。

return Promise.all([
  props.orderActions.set(orders, true),
  props.orderActions.set(orders, false),
]).then(() => {
  return this._ordersList.scrollToLocation({
    animated: false,
    sectionIndex: 0,
    itemIndex: historyItems.length - 1
  })
})

_ordersList 是对 SectionList 组件的引用。

谢谢!

【问题讨论】:

  • 每当您发布问题时,请确保添加代码,以便读者给出贴切的答案。
  • @Codesingh 感谢您的反馈。我已经更新了问题
  • 反应原生版本?
  • 我在某处读到 0.44 中没有添加 scrollToLocation,所以请尝试使用 0.45 并告诉我它是否适合您
  • 我调用了一个不同的组件。 :P

标签: react-native


【解决方案1】:

升级到 0.45 做到了。有性能问题,但设法通过使用 PureComponent 修复它

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-15
    • 1970-01-01
    • 1970-01-01
    • 2017-09-13
    • 2018-12-31
    • 2020-06-25
    • 1970-01-01
    相关资源
    最近更新 更多