From 9c19103411010efb5519c30ea93fbcd49f7ae47b Mon Sep 17 00:00:00 2001 From: wwwcg Date: Tue, 31 Oct 2023 16:39:31 +0800 Subject: [PATCH] fix(ios): add missing alwaysBounceVertical for ListView --- .../component/listview/NativeRenderBaseListView.mm | 7 +++++++ .../component/waterfalllist/NativeRenderWaterfallView.mm | 1 + 2 files changed, 8 insertions(+) diff --git a/renderer/native/ios/renderer/component/listview/NativeRenderBaseListView.mm b/renderer/native/ios/renderer/component/listview/NativeRenderBaseListView.mm index 5e12866e3b3..2c617ce7cd2 100644 --- a/renderer/native/ios/renderer/component/listview/NativeRenderBaseListView.mm +++ b/renderer/native/ios/renderer/component/listview/NativeRenderBaseListView.mm @@ -522,6 +522,13 @@ - (void)setHorizontal:(BOOL)horizontal { UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.collectionView.collectionViewLayout; layout.scrollDirection = horizontal ? UICollectionViewScrollDirectionHorizontal : UICollectionViewScrollDirectionVertical; [self.collectionView.collectionViewLayout invalidateLayout]; + if (horizontal) { + [self.collectionView setAlwaysBounceHorizontal:YES]; + [self.collectionView setAlwaysBounceVertical:NO]; + } else { + [self.collectionView setAlwaysBounceVertical:YES]; + [self.collectionView setAlwaysBounceHorizontal:NO]; + } } } diff --git a/renderer/native/ios/renderer/component/waterfalllist/NativeRenderWaterfallView.mm b/renderer/native/ios/renderer/component/waterfalllist/NativeRenderWaterfallView.mm index 3cc9d27a35a..f0875ee1a05 100644 --- a/renderer/native/ios/renderer/component/waterfalllist/NativeRenderWaterfallView.mm +++ b/renderer/native/ios/renderer/component/waterfalllist/NativeRenderWaterfallView.mm @@ -85,6 +85,7 @@ - (void)initCollectionView { collectionView.dataSource = self; collectionView.delegate = self; collectionView.layoutDelegate = self; + collectionView.alwaysBounceVertical = YES; collectionView.backgroundColor = [UIColor clearColor]; _collectionView = collectionView; [self registerCells];