1

I'm using react navigation 5.x material top tabs navigator in my app with two tabs, Inside of both the tabs I have swipe list view component.

I want to be able to swipe the rows on the list view but when I try to swipe them the tab is also gets swiped.

I can cancel the swipe on the tabs for good, but I want it to be enabled when the user will swipe outside of the dynamic list.

How can I do that? thanks for the help

4
  • Have u figured this out? Have the same issue Commented Dec 7, 2021 at 22:32
  • Unfortunately not.. Commented Dec 11, 2021 at 16:49
  • Did you find a solution yet? Commented Dec 18, 2021 at 8:23
  • No, I left this matter, maybe I will try in the future but don't count on it Commented Dec 21, 2021 at 21:15

1 Answer 1

1

I'm using @react-navigation v6.

on SwipeListView implement

  onTouchStart={({nativeEvent: {locationX: x}}) => {
    if (x > TAB_SWIPE_OFFSET &&
      x < Dimensions.get('screen').width - TAB_SWIPE_OFFSET
    ) {
      navigation.setOptions({swipeEnabled: false});
    } else {
      navigation.setOptions({swipeEnabled: true});
    }
  }}

  onTouchEnd={() => navigation.setOptions({swipeEnabled: true})}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.