airbnb / MagazineLayout

A collection view layout capable of laying out views in vertically scrolling grids and lists.
Apache License 2.0
3.28k stars 219 forks source link

Fix target content offset edge case for small content #120

Closed bryankeller closed 6 months ago

bryankeller commented 6 months ago

Details

This fixes an edge case with the target content offset anchor calculation. If the content is shorter than the visible bounds, that means we're simultaneously at our topmost offset and bottommost offset. In this scenario, the previous logic would always calculate a target content offset anchor of .top. The correct logic in this scenario should be:

Related Issue

Noticed a scenario where new messages don't push the content down when a thread is just getting started (short content height)

Motivation and Context

Squashin bugs

How Has This Been Tested

Example app

Types of changes

Checklist