iOS:add onScrollEnd

This commit is contained in:
pengfei.zhou 2020-03-04 13:57:04 +08:00 committed by osborn
parent 15ce9cb6ba
commit e7ac263921

View File

@ -152,6 +152,30 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
} }
} }
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
if (self.onScrollEndFuncId) {
[self callJSResponse:self.onScrollEndFuncId,
@{
@"x": @(self.view.contentOffset.x),
@"y": @(self.view.contentOffset.y),
},
nil];
}
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
if (!decelerate) {
if (self.onScrollEndFuncId) {
[self callJSResponse:self.onScrollEndFuncId,
@{
@"x": @(self.view.contentOffset.x),
@"y": @(self.view.contentOffset.y),
},
nil];
}
}
}
- (void)scrollTo:(NSDictionary *)params { - (void)scrollTo:(NSDictionary *)params {
BOOL animated = [params[@"animated"] boolValue]; BOOL animated = [params[@"animated"] boolValue];
NSDictionary *offsetDic = params[@"offset"]; NSDictionary *offsetDic = params[@"offset"];