Skip to content

Commit

Permalink
fix(ios): fix list item view type and onEndReach event not trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
ozonelmy authored and xuqingkuang committed Sep 11, 2020
1 parent d615374 commit 46bad5d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ios/sdk/component/listview/HippyBaseListItemView.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@interface HippyBaseListItemView : UIView

@property (nonatomic, strong) NSString *type;
@property (nonatomic, strong) id type;
@property (nonatomic, assign) BOOL isSticky;
@property (nonatomic, copy) HippyDirectEventBlock onAppear;
@property (nonatomic, copy) HippyDirectEventBlock onDisappear;
Expand Down
2 changes: 1 addition & 1 deletion ios/sdk/component/listview/HippyBaseListItemViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@implementation HippyBaseListItemViewManager
HIPPY_EXPORT_MODULE(ListViewItem)

HIPPY_EXPORT_VIEW_PROPERTY(type, NSString)
HIPPY_EXPORT_VIEW_PROPERTY(type, id)
HIPPY_EXPORT_VIEW_PROPERTY(isSticky, BOOL)
HIPPY_EXPORT_VIEW_PROPERTY(onAppear, HippyDirectEventBlock)
HIPPY_EXPORT_VIEW_PROPERTY(onDisappear, HippyDirectEventBlock)
Expand Down
12 changes: 1 addition & 11 deletions ios/sdk/component/listview/HippyBaseListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ @implementation HippyBaseListView {
BOOL _isInitialListReady;
NSUInteger _preNumberOfRows;
NSTimeInterval _lastScrollDispatchTime;
BOOL _hasFillListViewFrame;
CGFloat _nowHeight;
NSArray<HippyVirtualNode *> *_subNodes;
HippyHeaderRefresh *_headerRefreshView;
HippyFooterRefresh *_footerRefreshView;
Expand All @@ -88,7 +86,6 @@ - (instancetype)initWithBridge:(HippyBridge *)bridge
_isInitialListReady = NO;
_preNumberOfRows = 0;
_preloadItemNumber = 1;
_hasFillListViewFrame = NO;
[self initTableView];
}

Expand Down Expand Up @@ -320,16 +317,9 @@ - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)ce
lastRowIndexInSection = 0;
}

if (!_hasFillListViewFrame) {
_nowHeight += cell.frame.size.height;
if (_nowHeight > tableView.frame.size.height) {//只判断一次
_hasFillListViewFrame = YES;
_nowHeight = 0;
}
}
BOOL isLastIndex = [indexPath section] == lastSectionIndex && [indexPath row] == lastRowIndexInSection;

if (isLastIndex && _hasFillListViewFrame) {
if (isLastIndex) {
self.onEndReached(@{});
}
}
Expand Down

0 comments on commit 46bad5d

Please sign in to comment.