airbnb / airbnb/MagazineLayout

Reloading collectionview does not maintain content offset

Open
#56 9 comments 7 reactions 1 assignee Claimed by @bryankeller View on GitHub
Dominant language
Swift
Stars
3.4k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
When `reloadData()` is called, the `collectionView` sometimes doesn't preserve the scrolling position, causing the collectionView to jump abruptly

**To Reproduce**
Steps to reproduce the behavior:
1. Open and run the stock example project (workspacce) under `MagazineLayoutExample`
2. Please see the attached gif to reproduce this issue
Note: this doesn't occur every time, you need to adjust scrolling position before reloading the data if you cannot reproduce it at the beginning

**Expected behavior**
The screen should maintain its position after reloading data

**Screenshots**

![Untitled](https://user-images.githubusercontent.com/14969440/65793448-d8e55280-e133-11e9-8c3d-d8e81e66221a.gif)

**Smartphone (please complete the following information):**
- Simulator: iPhone 11 Pro Max
- OS: iOS 13.0
- Version: current

**Additional context**
Not sure if this could be a bug in UICollectionView rather than MagazineLayout, please advise.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.