Skip to content

Commit 807b813

Browse files
authored
Merge pull request #13 from abema/fix-quick-switch-glitch
Avoid glitch when tabs are quickly switched
2 parents 19949a3 + 38ccec6 commit 807b813

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Sources/SwipeMenuView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,11 @@ open class SwipeMenuView: UIView {
220220
return dataSource?.numberOfPages(in: self) ?? 0
221221
}
222222

223-
fileprivate var isJumping: Bool = false
223+
fileprivate var isJumping: Bool = false {
224+
didSet {
225+
tabView?.isUserInteractionEnabled = !isJumping
226+
}
227+
}
224228
fileprivate var isPortrait: Bool = true
225229

226230
/// The index of the front page in `SwipeMenuView` (read only).

Sources/TabView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ open class TabView: UIScrollView {
221221
let tabItemView = TabItemView(frame: CGRect(x: xPosition, y: 0, width: options.itemView.width, height: containerView.frame.size.height))
222222
tabItemView.translatesAutoresizingMaskIntoConstraints = false
223223
tabItemView.clipsToBounds = options.clipsToBounds
224+
tabItemView.isExclusiveTouch = true
224225
if let title = dataSource.tabView(self, titleForItemAt: index) {
225226
tabItemView.titleLabel.text = title
226227
tabItemView.titleLabel.font = options.itemView.font

0 commit comments

Comments
 (0)