Addressing an AutoScrollAction issue when using VerticalLayoutGravity.bottom#572
Conversation
488488c to
a4db6bd
Compare
|
Note: there are similar existing issues with |
586477f to
be0e624
Compare
| if animated { | ||
| stateObserver.onDidEndScrollingAnimation { state in | ||
| pin.didPerform(self.scrollPositionInfo) | ||
| } |
There was a problem hiding this comment.
Using self within this onDidEndScrollingAnimation { ... } closure was causing a ListView memory leak. This is fixed - the Pin and OnInsertedItem behaviors funnel through one function that uses state.positionInfo.
| /// asynchronously update the underlying `contentSize` as part of the initial layout, | ||
| /// moments after this method is executed. The list's `contentSize` is overridden to | ||
| /// keep the offset anchored to the bottom when using `VerticalLayoutGravity.bottom`. | ||
| collectionView.performBatchUpdates(nil) |
There was a problem hiding this comment.
I think you may actually want to call this one? For iOS 16 which still has the bug that code fixes. You can pass an empty CollectionViewChanges IIRC
There was a problem hiding this comment.
Thanks for the info. I've pushed up a change in f82f3d8 to add a private performEmptyBatchUpdates() function that uses an empty CollectionViewChanges.
kyleve
left a comment
There was a problem hiding this comment.
One comment on which method to call, otherwise LGTM! Nice work
ef30570 to
f82f3d8
Compare
|
|
||
| /// This protocol allows `ListView` to treat the `OnInsertedItem` and `Pin` behaviors | ||
| /// in a similar fashion. | ||
| public protocol Behavior { |
There was a problem hiding this comment.
I don't have any suggestions for better alternatives but Behavior feels a little weird here. Like it's almost more of a config? IDK
There was a problem hiding this comment.
Thanks for the feedback and good point - this protocol exists mostly for configuring the AutoScrollAction. I may go with AutoScrollAction.Configuration instead of AutoScrollAction.Behavior. Does Configuration feel like it fits a bit better?
…-headerfooters * origin/main: build: set up tuist (#584) Bumping versions to 16.3.0 (#589) Reset scroll position if list identifier changes (#588) Bumping versions to 16.2.0 (#587) Adding a completion handler to the `scrollToSection` API. (#585) Adding a programmatic scroll completion handler (#582) Remove iOS 19 (26) cap of the collection view first responder workaround (#581) Bumping versions to 16.1.0 (#583) Update for Blueprint 6.0.0 (#580) Bumping versions to 16.0.4. (#579) Update the first responder resignation workaround to be enabled by default and cap at < iOS 19 [UI-8849] (#578) Bumping versions to 16.0.3 (#577) Bottom gravity and autoscroll improvements (#576) Bumping versions to 16.0.2 (#574) Addressing an AutoScrollAction issue when using VerticalLayoutGravity.bottom (#572) release: Prepare 16.0.1 release (#569) Fix reordering crash introduced in 16.0 (#568)
contentSizebefore auto-scrolling. This will scroll after thecontentSizelogic within CollectionView (here) has adjusted the offset.didPerformclosure are synced with the visible items after scrolling.Checklist
Please do the following before merging:
Mainsection.