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

Not scrolling to scrollId inside List #16

Open
DanSkeel opened this issue Jun 7, 2021 · 4 comments
Open

Not scrolling to scrollId inside List #16

DanSkeel opened this issue Jun 7, 2021 · 4 comments

Comments

@DanSkeel
Copy link

DanSkeel commented Jun 7, 2021

  1. Frames has zero offset when you use AmzdScrollViewReader inside List
  2. You can't scroll to the row that is not yet appeared
@Amzd
Copy link
Owner

Amzd commented Jun 7, 2021

Yeah this is because List has lazy views so they won't actually exist until needed. If they dont exist then we can't get the frame. I don't have a solution for this issue right now, I am sorry for the inconvenience.

You can try to tackle this problem and make a PR or restructure to use a ScrollView.

@Amzd
Copy link
Owner

Amzd commented Jun 7, 2021

Possible starting points to get this working is trying to Introspect the underlying view for List, it should be a table view or collection view, which you could then ask for the frame of a view maybe?

@DanSkeel
Copy link
Author

DanSkeel commented Jun 7, 2021

Thanks for feedback, yes its UITableView there but it can be tricky to map indexes onto IDs.

Also the first problem with frames seams to be caused by coordinateSpace and geometry.frame(in: .named(space)) because it gives offsets in ScrollView and in List they are zeros even for visible cells.
I don't get how to figure out whats going on there.

@Amzd
Copy link
Owner

Amzd commented Jun 7, 2021

From the README:

An important difference between this library and Apples implementation is that the ScrollViewReader goes inside the ScrollView. If you place the ScrollViewReader around the ScrollView the scrollTo function will not scroll to the correct location (due to its coordinateSpace not being part of the scrolling content). I considered fixing this to align with Apple but that would break backwards compatibility with projects already using ScrollViewProxy.

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

2 participants