ScrollViewProxy
ScrollViewProxy copied to clipboard
Not scrolling to `scrollId` inside List
- Frames has zero offset when you use
AmzdScrollViewReaderinsideList - You can't scroll to the row that is not yet appeared
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.
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?
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.
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.