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

How to dismiss fpc by drag content controller's scroll view #530

Closed
karthuszY opened this issue Feb 18, 2022 · 7 comments · Fixed by #599
Closed

How to dismiss fpc by drag content controller's scroll view #530

karthuszY opened this issue Feb 18, 2022 · 7 comments · Fixed by #599

Comments

@karthuszY
Copy link

Description

When the fpc contentViewController has scrollView, i can't dismiss it by drag the content.
It's now only can drag the grabberHandle area to dismiss.

Expected behavior

When scroll view is at top, drag it to dismiss fpc.

@scenee
Copy link
Owner

scenee commented Feb 18, 2022

FloatingPanelController doesn't track a scroll view in the content automatically. Please call this method to recognize a scroll view to it.

let fpc = FloatingPanelController()
...
fpc.track(scrollView: contentVC.scrollView)

@karthuszY
Copy link
Author

FloatingPanelController doesn't track a scroll view in the content automatically. Please call this method to recognize a scroll view to it.

let fpc = FloatingPanelController()
...
fpc.track(scrollView: contentVC.scrollView)

I have tried it. But it still does not work? Should I config anything more?

@futuretap
Copy link
Contributor

This doesn't work for me, at least only partially.

What does work is to quickly flick and let go. Then the scrollView bounce is connected with a bounce of the panel.
However, when starting the scroll from an offset below the top and dragging towards the bottom, the scrollView simply stops scrolling and the panel doesn't move.

I've added this to the extension MainViewController: UITableViewDelegate in SearchViewController.swift:

func scrollViewDidScroll(_ scrollView: UIScrollView) {
	fpc.followScrollViewBouncing()
}

I analyzed the problem and found that due to calling lockScrollView(strict: true) the scrollView no longer sends didScroll events. The gesture handling code is quite complex, so I'm unaware how to fix this. @scenee, can you take a look?

FloatingPanel.scroll.issue.mov

@scenee
Copy link
Owner

scenee commented Jul 6, 2023

@futuretap
Thank you for providing your feedback. I greatly appreciate it. Your screen recording has helped me understand the steps to reproduce this issue. After debugging the code, I found the root cause is that the prioritization of panel and scroll gestures. I will continue to investigate and resolve this issue.

@futuretap
Copy link
Contributor

thanks, looks good!

@futuretap
Copy link
Contributor

Btw, Apple's Maps app suffers from the exact same problem. They should use your implementation 😉

@scenee
Copy link
Owner

scenee commented Jul 19, 2023

It's the power of community! Thanks for your help 😄

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

Successfully merging a pull request may close this issue.

3 participants