Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RTL/Batching] Make ASDisplayShouldFetchBatchForScrollView aware of flipped CV layouts #1985

Merged
merged 3 commits into from
May 3, 2021

Commits on Apr 30, 2021

  1. [RTL/Batching] Make ASDisplayShouldFetchBatchForScrollView aware of f…

    …lipped CV layouts
    
    UICollectionViewLayout has a property called `flipsHorizontallyInOppositeLayoutDirection`. If this is set to `YES` then a RTL collectionView’s contentOffset behaves like it does in LTR. In other words, the first item is at contentOffset 0. In this case, the existing logic for `ASDisplayShouldFetchBatchForScrollView` works in RTL.
    
    If you don’t override `flipsHorizontallyInOppositeLayoutDirection` to be `YES`, then it means that in RTL languages the first item in your collectionView will actually be at x offset `collectionView.contentSize.width - collectionView.frame.size.width`. As you scroll to the right, the content offset will decrease until you reach the end of the data at a content offset of 0,0. In this case, `ASDisplayShouldFetchBatchForScrollView` needs to know that you are in RTL and the layout is not flipped. It can then use the contentOffset as the `remainingDistance` to determine when to fetch.
    rcancro committed Apr 30, 2021
    Configuration menu
    Copy the full SHA
    4ee877d View commit details
    Browse the repository at this point in the history

Commits on May 3, 2021

  1. fix indentation

    rcancro committed May 3, 2021
    Configuration menu
    Copy the full SHA
    168f71c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4edc28d View commit details
    Browse the repository at this point in the history