Skip to content

Commit

Permalink
fix(ios): showScrollIndicator not working on horizontal list
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg authored and hippy-actions[bot] committed Jan 12, 2024
1 parent ed7c8df commit 6893636
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,19 @@ - (BOOL)bounces {
}

- (void)setShowScrollIndicator:(BOOL)show {
[self.collectionView setShowsVerticalScrollIndicator:show];
if (self.horizontal) {
[self.collectionView setShowsHorizontalScrollIndicator:show];
} else {
[self.collectionView setShowsVerticalScrollIndicator:show];
}
}

- (BOOL)showScrollIndicator {
return [self.collectionView showsVerticalScrollIndicator];
if (self.horizontal) {
return [self.collectionView showsHorizontalScrollIndicator];
} else {
return [self.collectionView showsVerticalScrollIndicator];
}
}

- (void)setScrollEnabled:(BOOL)value {
Expand Down Expand Up @@ -384,6 +392,7 @@ - (CGFloat)collectionView:(UICollectionView *)collectionView

- (void)setHorizontal:(BOOL)horizontal {
if (_horizontal != horizontal) {
BOOL previousShowScrollIndicator = self.showScrollIndicator;
_horizontal = horizontal;
UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.collectionView.collectionViewLayout;
layout.scrollDirection = horizontal ? UICollectionViewScrollDirectionHorizontal : UICollectionViewScrollDirectionVertical;
Expand All @@ -395,6 +404,9 @@ - (void)setHorizontal:(BOOL)horizontal {
[self.collectionView setAlwaysBounceVertical:YES];
[self.collectionView setAlwaysBounceHorizontal:NO];
}
if (self.showScrollIndicator != previousShowScrollIndicator) {
[self setShowScrollIndicator:previousShowScrollIndicator];
}
}
}

Expand Down

0 comments on commit 6893636

Please sign in to comment.