Skip to content

ModalWrapper opening on swipe to go to previous screen, but shouldn't #16

Description

@olinations

I am not sure if this is a bug with react-native-modal-wrapper or react-native-swipe-gestures or with react-navigation, or if my code just isn't up to par, but please hear me out.

When I swipe right to left on this page it shows the ModalWrapper. When I swipe from left to right it hides the ModalWrapper. However, when I swipe from the far left edge to right to go back to the previous page it goes to the previous page but at the same it shows the ModalWrapper opening. This makes no sense to me.

I have tried removing the onSwipeRight() event and that made no difference. I tried changing the settings of the swipeConfig and that made no difference. I tried putting the ModalWrapper inside and outside the GestureRecognizer and that made no difference.

It appears when you first show the ModalWrapper it mounts to the screen, but when you hide it it doesn't unmount, not sure if that is relevant.

This is used in a functional component, not sure if that is relevant either.

  <SafeAreaView style={{flex: 1, backgroundColor: '#fff'}}>

    <GestureRecognizer
        onSwipeLeft={() => setShowingMenu(true)}
        onSwipeRight={() => setShowingMenu(false)}
        config={swipeConfig}
        style={{
          flex: 1,
        }} >

      <ScrollView>
            {content}
      </ScrollView>

    </GestureRecognizer>

    <ModalWrapper
            containerStyle={{ flexDirection: 'row', justifyContent: 'flex-end' }}
            onRequestClose={() => setShowingMenu(false)}
            position="right"
            style={styles.modalContainer}
            visible={showingMenu}>
          <Menu  />
    </ModalWrapper>

  </SafeAreaView>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions