react-native-swipe-gestures icon indicating copy to clipboard operation
react-native-swipe-gestures copied to clipboard

Swipe gesture blocks range bar swipe

Open acollazomayer opened this issue 6 years ago • 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

acollazomayer avatar May 14 '18 01:05 acollazomayer

+1

hanishcodebrew avatar Aug 24 '18 12:08 hanishcodebrew

+1

geminiyellow avatar Sep 25 '18 03:09 geminiyellow

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>

pistou avatar Oct 15 '18 10:10 pistou

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.

taylorkearns avatar Mar 29 '19 14:03 taylorkearns