feat:List add scrollToItem method

This commit is contained in:
pengfei.zhou
2020-04-22 11:18:21 +08:00
committed by osborn
parent 2541a13d74
commit 5f4942a8ff
12 changed files with 129 additions and 6 deletions

View File

@@ -107,6 +107,10 @@ - (void)blendView:(UITableView *)view forPropName:(NSString *)name propValue:(id
self.onScrollFuncId = prop;
} else if ([@"onScrollEnd" isEqualToString:name]) {
self.onScrollEndFuncId = prop;
} else if ([@"scrolledPosition" isEqualToString:name]) {
dispatch_async(dispatch_get_main_queue(), ^{
[view scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[prop unsignedIntegerValue] inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
});
} else {
[super blendView:view forPropName:name propValue:prop];
}
@@ -301,4 +305,10 @@ - (void)removeDidScrollBlock:(__nonnull DoricDidScrollBlock)didScrollListener {
[self.didScrollBlocks removeObject:didScrollListener];
}
- (void)scrollToItem:(NSDictionary *)params {
BOOL animated = [params[@"animated"] boolValue];
NSUInteger scrolledPosition = [params[@"pos"] unsignedIntegerValue];
[self.view scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:scrolledPosition inSection:0] atScrollPosition:UITableViewScrollPositionNone animated:animated];
}
@end