File tree 1 file changed +12
-1
lines changed
doric-iOS/Pod/Classes/Shader
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -663,7 +663,18 @@ - (void)scrollToItem:(NSDictionary *)params {
663
663
for (int i = 0 ; i <= scrolledPosition; i++) {
664
664
[self calculateCellHeightItemNode: node atIndexPath: [NSIndexPath indexPathForRow: i inSection: 0 ]];
665
665
}
666
- [self .view scrollToRowAtIndexPath: [NSIndexPath indexPathForRow: scrolledPosition inSection: 0 ] atScrollPosition: UITableViewScrollPositionNone animated: animated];
666
+
667
+ if (params[@" topOffset" ] != nil ) {
668
+ CGFloat topOffset = [params[@" topOffset" ] floatValue ];
669
+ [self .view layoutIfNeeded ];
670
+ NSIndexPath *targetIndexPath = [NSIndexPath indexPathForRow: scrolledPosition inSection: 0 ];
671
+ CGRect rect = [self .view rectForRowAtIndexPath: targetIndexPath];
672
+ CGPoint newContentOffset = CGPointMake (self.view .contentOffset .x , rect.origin .y + topOffset);
673
+
674
+ [self .view setContentOffset: newContentOffset animated: animated];
675
+ } else {
676
+ [self .view scrollToRowAtIndexPath: [NSIndexPath indexPathForRow: scrolledPosition inSection: 0 ] atScrollPosition: UITableViewScrollPositionNone animated: animated];
677
+ }
667
678
});
668
679
} else {
669
680
[self .doricContext.driver.registry onLog: DoricLogTypeError
You can’t perform that action at this time.
0 commit comments