(index: number, animated = true)
| 648 | } |
| 649 | |
| 650 | private _scrollToIndex(index: number, animated = true) { |
| 651 | if (!this.nativeViewProtected) { |
| 652 | return; |
| 653 | } |
| 654 | |
| 655 | const itemsLength = this.items ? this.items.length : 0; |
| 656 | // mimic Android behavior that silently coerces index values within [0, itemsLength - 1] range |
| 657 | if (itemsLength > 0) { |
| 658 | if (index < 0) { |
| 659 | index = 0; |
| 660 | } else if (index >= itemsLength) { |
| 661 | index = itemsLength - 1; |
| 662 | } |
| 663 | |
| 664 | this.nativeViewProtected.scrollToRowAtIndexPathAtScrollPositionAnimated(NSIndexPath.indexPathForItemInSection(index, 0), UITableViewScrollPosition.Top, animated); |
| 665 | } else if (Trace.isEnabled()) { |
| 666 | Trace.write(`Cannot scroll listview to index ${index} when listview items not set`, Trace.categories.Binding); |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | public refresh() { |
| 671 | // clear bindingContext when it is not observable because otherwise bindings to items won't reevaluate |
no test coverage detected