我刚刚将我的 ListView 更改为 React Native 的新 SectionList,现在当我尝试使用 scrollTo 函数时应用程序崩溃,并指出它未定义。我尝试查找可能有帮助的新功能/替代功能,但它们似乎都不起作用。
使用新的 SectionList 以编程方式滚动到特定部分的正确协议(protocol)是什么?
到目前为止我一直在咨询的链接: https://github.com/facebook/react-native/issues/13151 https://facebook.github.io/react-native/releases/0.43/docs/virtualizedlist.html#scrolltoend
我目前的尝试:
var params = {animated:true,offset:Platform.OS == "ios" ? 244 : 264}
_mainListView.scrollToOffset(params)
最佳答案
<SectionList
ref={(sectionList) => { this.sectionList = sectionList }} .../>
this.sectionList.scrollToLocation(
{
sectionIndex: sectionIndex,
itemIndex: itemIndex
}
);
这就是我过去使用这篇文章和 https://snack.expo.io/HJp9mEQkG 的组合来让它工作的方法
关于javascript - react native SectionList 滚动到部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43452859/