收藏
回答

skyline 手势操作返回报错null reading \'touches\'?

报错信息:Cannot read properties of null (reading \'touches\')

报错机型多为安卓机(JEF-AN00、JAD-AL50、ANN-AN00、2206123SC),微信版本8.0.48、8.0.49

代码片段

<vertical-drag-gesture-handler
  tag="pan"
  shouldResponseOnMove="shouldPanResponse"
  simultaneousHandlers="{{ ['scroll'] }}"
  onGestureEvent="handleVerticalDrag"
  style="flex: 1; overflow: auto;width: 100%;"
>
  <view>...<view>
<vertical-drag-gesture-handler>

js代码片段

handleVerticalDrag(evt) {
  'worklet';

  if (!this.customRouteContext) return;
  if (evt.state === GestureState.BEGIN) {
    this.handleDragStart();
  } else if (evt.state === GestureState.ACTIVE) {
    const delta = evt.deltaY / windowHeight;
    this.handleDragUpdate(delta);
  } else if (evt.state === GestureState.END) {
    const velocity = evt.velocityY / windowHeight;
    this.handleDragEnd(velocity);
    this.jsWorklet(evt.state);
  } else if (evt.state === GestureState.CANCELLED) {
    this.handleDragEnd(0.0);
    this.jsWorklet(evt.state);
  }
}
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容