Skip to content

Commit

Permalink
fix(ios): banner view of waterfall not working (#4050)
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg committed Oct 8, 2024
1 parent a196111 commit d814b31
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ - (void)hippyBridgeDidFinishTransaction {
- (void)reloadData {
NSArray<HippyShadowView *> *datasource = [self.hippyShadowView.hippySubviews copy];
_dataSource = [[HippyWaterfallViewDataSource alloc] initWithDataSource:datasource
itemViewName:[self compoentItemName]
containBannerView:_containBannerView];
itemViewName:[self compoentItemName]
containBannerView:_containBannerView];

[self.collectionView reloadData];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
* limitations under the License.
*/

#import <UIKit/NSIndexPath+UIKitAdditions.h>

#import "HippyAssert.h"
#import "HippyWaterfallViewDataSource.h"
#import "HippyAssert.h"
#import "HippyShadowView.h"
#import "HippyShadowListView.h"
#import "HippyHeaderRefreshManager.h"

@interface HippyWaterfallViewDataSource () {
BOOL _containBannerView;
Expand Down Expand Up @@ -71,7 +70,16 @@ - (void)setDataSource:(NSArray<HippyShadowView *> *)dataSource
_containBannerView = containBannerView;
if ([dataSource count] > 0) {
if (containBannerView) {
_bannerView = [dataSource firstObject];
// find the first shadowView that is not pull header or pull footer
for (int i = 0; i < dataSource.count; i++) {
HippyShadowView *subShadowView = [dataSource objectAtIndex:i];
if ([subShadowView.viewName isEqualToString:HippyHeaderRefreshManager.moduleName]) {
continue;
} else {
_bannerView = subShadowView;
break;
}
}
}
NSUInteger loc = _containBannerView ? 1 : 0;
NSArray<HippyShadowView *> *candidateRenderObjectViews = [dataSource subarrayWithRange:NSMakeRange(loc, [dataSource count] - loc)];
Expand Down

0 comments on commit d814b31

Please sign in to comment.