Skip to content

Commit f339db2

Browse files
committed
Fixes #4843 - Prevent home screen horizontal scroll views from capturing side menu swipe gestures.
1 parent 521d75e commit f339db2

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

Riot/Modules/TabBar/TabBarCoordinator.swift

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,8 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
259259
}
260260

261261
private func setupSideMenuGestures() {
262-
if let rootViewController = self.masterNavigationController.viewControllers.first {
263-
self.parameters.appNavigator.sideMenu.addScreenEdgePanGesturesToPresent(to: rootViewController.view)
264-
}
262+
let gesture = self.parameters.appNavigator.sideMenu.addScreenEdgePanGesturesToPresent(to: masterTabBarController.view)
263+
gesture.delegate = self
265264
}
266265

267266
// MARK: Navigation
@@ -382,3 +381,27 @@ extension TabBarCoordinator: MasterTabBarControllerDelegate {
382381
self.splitViewMasterPresentableDelegate?.splitViewMasterPresentable(self, wantsToDisplay: detailViewController)
383382
}
384383
}
384+
385+
// MARK: - UIGestureRecognizerDelegate
386+
387+
/**
388+
Prevent the side menu gesture from clashing with other gestures like the home screen horizontal scroll views.
389+
Also make sure that it doesn't cancel out UINavigationController backwards swiping
390+
*/
391+
extension TabBarCoordinator: UIGestureRecognizerDelegate {
392+
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRequireFailureOf otherGestureRecognizer: UIGestureRecognizer) -> Bool {
393+
return false
394+
}
395+
396+
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
397+
return true
398+
}
399+
400+
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
401+
if otherGestureRecognizer.isKind(of: UIScreenEdgePanGestureRecognizer.self) {
402+
return false
403+
} else {
404+
return true
405+
}
406+
}
407+
}

changelog.d/4843.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Prevent home screen horizontal scroll views from capturing side menu swipe gestures.

0 commit comments

Comments
 (0)