Instagram / Instagram/IGListKit

Scrolling offset might be wrong when scrolling backwards using scrollToObject: method

Open
#1,239 4 comments 0 reactions 0 assignees View on GitHub
bug question
Dominant language
Objective-C
Stars
13.1k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

## New issue checklist

- [x] I have reviewed the [`README`](https://github.com/Instagram/IGListKit/blob/master/README.md) and [documentation](http://instagram.github.io/IGListKit)
- [x] I have searched [existing issues](https://github.com/Instagram/IGListKit/issues) and this is not a duplicate

### General information

- `IGListKit` version: 3.0
- iOS version(s): 11.4
- CocoaPods/Carthage version:
- Xcode version: 9.4.1
- Devices/Simulators affected: all
- Reproducible in the demo project? (Yes/No): Yes
- Related issues: /

### Debug information

Hi, i am using IGListKit with supplementaryHeaderViews but i am facing an issue when i want to use the `scrollToObject:` method inside the adapter. When the visible sections are greater then the one that i want to scroll to it scrolls to the correct object but the sections are not fully visible.

You can reproduce the issue in one of the Demo Projects, the one for the Supplementary Views if you scroll to bottom manually but add scroll to index 0 to be executed after some delay. I am using the following code:

```
let item = feedItems[0]
DispatchQueue.main.asyncAfter(deadline: .now()+5) {
self.adapter.scroll(to: item, supplementaryKinds: [UICollectionElementKindSectionHeader, UICollectionElementKindSectionFooter], scrollDirection: .vertical, scrollPosition: .top, animated: true)
}
```

Am i doing something wrong or the contentOffset calculations is bad.

Thank you !

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.