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

Gesture don't work on Model

Open intellij-Shivam opened this issue 4 years ago • 3 comments

I have added a down gesture to a model, and it doesn't recognize it

intellij-Shivam avatar Jul 27 '20 06:07 intellij-Shivam

@intellij-Shivam have got any solution for this?

Ravi448 avatar Sep 25 '20 06:09 Ravi448

Guys, take a look at this https://github.com/facebook/react-native/issues/14295#issuecomment-374012339. This package is based on PanResponder, so all you have to do is this:

render() {
    /**
     * Im using the TouchableWithoutFeedback with its View as a workaround
     * so that this component is swipable even when it is inside a modal,
     * because modals do not release their responder properly.
     */
    return (
      <Modal>
        <View>
          <GestureRecognizer {...props}>
            <TouchableWithoutFeedback>
              <View>
                
                // The component's content goes here
    
              </View>
            </TouchableWithoutFeedback>
          </GestureRecognizer>
        </View>
      </Modal>
    );
  }

This worked for me (:

gdeusdara avatar Jan 19 '21 21:01 gdeusdara

You need to wrap your Modal component with GestureRecognizer like so

<GestureRecognizer {...props}>
  <Modal>
        // other code
  </Modal>
</GestureRecognizer>

shahjahanpak avatar Jan 05 '22 15:01 shahjahanpak