ScrollView滚动响应器中断Component的pan响应器

时间:2018-02-17 10:02:46

标签: react-native

我正在制作一个包含自定义组件及其PanResponder的可滚动视图。

这是我的主要观点:

([^/]+)/

这是我的CustomComponent:

<ScrollView>
    <CustomComponent />
    <CustomComponent />
    <CustomComponent />
</ScrollView>

现在,当我尝试拖放CustomComponent(通过PanResponder实现)时,由于滚动响应程序事件,它会在两者之间停顿。我找到了一个在PanResponderMove事件期间禁用滚动的解决方案:screen shot on setting但我不知道如何使它工作。

我只能在主视图中禁用滚动,但我的平移响应器位于子视图(CustomComponent)中,如何将信息传递给泛视图处于活动状态的父视图(主视图),以便ScrollView滚动事件被禁用了?

1 个答案:

答案 0 :(得分:0)

对我有用的是在 onPanResponderTerminationRequest 函数中添加 create,如下所示:

PanResponder.create({
  onPanResponderTerminationRequest: () => false,
  onPanResponderMove: ...
  ...
})
相关问题