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

fix(ios): banner view of waterfall not working #4050

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading