glepur/react-native-swipe-gestures

Swipe gesture blocks range bar swipe

acollazomayer opened this issue · 4 comments

I have the react-native-video-controls over a video, i want to implement some swipe events to change the video source. I manage to make this work. However i am now unable to swipe the volume down or even move the seek bar. Hope i can find any help

I had a similar issue with this plugin. I understood that it catches the event at first, as it is higher in the component tree. Basically, every PanResponder-based element nested into GestureRecognizer will fail at some point.
I made a workaround for this, it is a bit hacky but it works for my needs, maybe it could help you.

I modified the _handleShouldSetPanResponder function from source, to check the target of the catched event ; if it has the property ignoreSwipe, then I don't want to actually catch this event in GestureRecognizer

_handleShouldSetPanResponder(evt, gestureState) {
    if (evt._targetInst.memoizedProps.children) {
        if (evt._targetInst.memoizedProps.children.props) {
            if (evt._targetInst.memoizedProps.children.props.ignoreSwipe) { // you could change ignoreSwipe to whatever
                return false
            }
        }
    }
    
    return evt.nativeEvent.touches.length === 1 && !this._gestureIsClick(gestureState);
}


// example
<GestureRecognizer>
    <ComponentWithPanResponder ignoreSwipe={true} />
</GestureRecognizer>

But this component shouldn't be capturing the events unless we explicitly set on*ShouldSetPanReponderCapture, correct? And it doesn't appear to be doing that. I'm noticing the same behavior w/ my implementation.