Skip to content

Commit

Permalink
Reset the collection view position based on layout direction
Browse files Browse the repository at this point in the history
  • Loading branch information
wargcm committed Apr 26, 2024
1 parent ee095b1 commit 0a19acf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion WordPress/Classes/ViewRelated/Reader/ReaderTagCardCell.swift
Expand Up @@ -67,7 +67,7 @@ class ReaderTagCardCell: UITableViewCell {
if viewModel?.slug == tag.slug {
return
}
collectionView.scrollToStart(animated: false)
resetScrollPosition()
weak var weakSelf = self
viewModel = ReaderTagCardCellViewModel(parent: parent,
tag: tag,
Expand Down Expand Up @@ -174,4 +174,13 @@ private extension ReaderTagCardCell {
ghostableCollectionView.removeFromSuperview()
}

func resetScrollPosition() {
let isRTL = UIView.userInterfaceLayoutDirection(for: .unspecified) == .rightToLeft
if isRTL {
collectionView.scrollToEnd(animated: false)
} else {
collectionView.scrollToStart(animated: false)
}
}

}

0 comments on commit 0a19acf

Please sign in to comment.