Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swipe actions are stuck when you add a gesture recognizer to container view of SwipeListView #596

Open
cnytayvaz opened this issue Apr 6, 2022 · 7 comments

Comments

@cnytayvaz
Copy link

Describe the bug:
I want to listen swipe gestures for logging purposes on the screen where I'm using the SwipeListView, so I added an UISwipeGestureRecognizer to the SwipeListView's container view. After that I saw that SwipeListView's actions are stuck.

To Reproduce:
You can reproduce the issue by adding any gesture recognizer to the window or the rootView in the appDelegate class of the example project, detailed below.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"SwipeListExample"
                                            initialProperties:nil];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

  UISwipeGestureRecognizer *leftSwipeGesture = [[UISwipeGestureRecognizer alloc]
                                                initWithTarget:self
                                                action:@selector(handleSwipe:)];
  leftSwipeGesture.direction = UISwipeGestureRecognizerDirectionLeft;
  leftSwipeGesture.cancelsTouchesInView = NO;
  [self.window addGestureRecognizer:leftSwipeGesture];

  UISwipeGestureRecognizer *rightSwipeGesture = [[UISwipeGestureRecognizer alloc]
                                                 initWithTarget:self
                                                 action:@selector(handleSwipe:)];
  rightSwipeGesture.direction = UISwipeGestureRecognizerDirectionRight;
  rightSwipeGesture.cancelsTouchesInView = NO;
  [self.window addGestureRecognizer:rightSwipeGesture];

  return YES;
}

- (void) handleSwipe: (UISwipeGestureRecognizer *)recognizer
{
    //Code to handle the gesture
}

Screenshots:
issue

Environment:

  • OS: iOS 15
  • RNSLV Version: 3.2.9
  • RN Version: 0.64.2
@ireneMel
Copy link

ireneMel commented May 5, 2023

Hi! Were you able to solve this?

@shreyn1
Copy link

shreyn1 commented Sep 21, 2023

Facing the same issue when I am using this inside @react-navigation/material-top-tabs

@thbd
Copy link

thbd commented Nov 4, 2023

Facing the same issue when I am using this inside @react-navigation/material-top-tabs

Exact same problem for me. How did you solve your issue ?

@shreyn1
Copy link

shreyn1 commented Nov 5, 2023

One of the solutions I got online was to downgrade the version of react-native-tab-view. But was still causing issues.

Later, I changed the direction of swipe options from right to left.

@thbd
Copy link

thbd commented Nov 5, 2023

Thank you for your answer. Unfortunately, both options I cannot do... I don't know what is causing the issue. Even disabling swiping gesture on Tabs does not unstuck the row swipe

@shreyn1
Copy link

shreyn1 commented Nov 6, 2023

Instead of using @react-native/material-top-tabs. You can try to use react-native-pager-view. Maybe that will work fine. I have not tried it.

@Anurag-Raut
Copy link

has anyone found solution to this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants