wix-incubator / react-native-interactable

Experimental implementation of high performance interactable views in React Native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Android] Touch intercept issue

moonjava2005 opened this issue · comments

Dear all,
There're some issues on onInterceptTouchEvent when we use as combination with another touch processing (for example, if we use pinch gesture in side interatable)
I just modify a little bit change in InteractableView.java

public boolean onInterceptTouchEvent(MotionEvent ev) {

    final int pointerCount = ev.getPointerCount();
    final int maxPointerCount=1;
   //We can add maxPointerCount as props from JS
    if (pointerCount <= maxPointerCount) {
         .............
         boolean isHSwipe = Math.abs(delX) > mTouchSlop;
            boolean isVSwipe = Math.abs(delY) > mTouchSlop;

            this.isSwiping = this.isSwiping || isHSwipe || isVSwipe;
           
            if (!isChildIsScrollContainer && dragEnabled && (horizontalOnly && isHSwipe ||
                    verticalOnly && isVSwipe ||
                    !horizontalOnly && !verticalOnly)) {

                // we are giving opportunity intercept the action to the ChildrenViews
                if (!skippedOneInterception) {
                    skippedOneInterception = true;
                } else {
                    startDrag(ev);
                    return true;
                }
            }
    }

}