feat:List add scrollToItem method
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user