-
Notifications
You must be signed in to change notification settings - Fork 59
Description
I have a DrawerView with a descendent UITableView inside a containerView. That tableview extends under a sibling header view so that the header can be collapsed to reveal more of the tableview on scroll. (Similar to how Apple collapses the Navigation Bar to show more content when you scroll).
To achieve this I set a contentInset for the top of the tableview so content can be fully exposed while the header view is fully expanded.
tableview.contentInset = UIEdgeInset(top:175, left:0, bottom:view.safeAreaInsets.bottom, right:0)
However, DrawerView's handlePan() is not taking the content inset into account when determining if there is more content in the scrollview to be shown
The fix is to change the line 810 in DrawerView:
let childReachedTheTop = activeScrollViews.contains { $0.contentOffset.y <= 0 }
to:
let childReachedTheTop = activeScrollViews.contains { $0.contentOffset.y <= -$0.contentInset.top }
and this also necessitates a change to line 837:
let minContentOffset = activeScrollViews.map { $0.contentOffset.y }.min() ?? 0
to
let minContentOffset = activeScrollViews.map { $0.contentOffset.y + $0.contentInset.top}.min() ?? 0
Happy to make a pull request with the fix, but need to take a look at the unit test setup you have first, if it even something you'd want to add a unit test for.
Great component BTW!