Ger*_*som 11 react-native expo
我构建了一个滚动SectionList的字母擦洗器.SectionList通过使用getItemLayout进行优化.如果我擦洗字母表,滚动按计划进行,但是在我从屏幕上松开手指之前,SectionList不会重新渲染.
关于如何解决这个问题的任何想法?
通过浏览PanResponder的源代码解决了这个问题.PanResponder通过InteractionManager设置交互句柄.您可以通过this.panResponder.getInteractionHandle()(未记录的功能)访问此句柄,然后每次滚动到SectionList中的某个位置时清除它:
if (this.panResponder.getInteractionHandle()) {
InteractionManager.clearInteractionHandle(
this.panResponder.getInteractionHandle()
);
}
Run Code Online (Sandbox Code Playgroud)
这会将SectionList移动到队列中以进行可见性计算和渲染.
我建议通过尽可能少地清除交互句柄来对此进行大量优化,因为出于性能原因使用了InteractionManager.
| 归档时间: |
|
| 查看次数: |
816 次 |
| 最近记录: |