| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -90,6 +90,10 @@ export abstract class ListViewBase extends View implements ListViewDefinition, T | |||
| 90 | 90 | // | |
| 91 | 91 | } | |
| 92 | 92 | ||
| 93 | + public scrollToIndexAnimated(index: number) { | ||
| 94 | + // | ||
| 95 | + } | ||
| 96 | + | ||
| 93 | 97 | public _getItemTemplate(index: number): KeyedTemplate { | |
| 94 | 98 | let templateKey = "default"; | |
| 95 | 99 | if (this.itemTemplateSelector) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,6 +124,13 @@ export class ListView extends ListViewBase { | |||
| 124 | 124 | } | |
| 125 | 125 | } | |
| 126 | 126 | ||
| 127 | + public scrollToIndexAnimated(index: number) { | ||
| 128 | + const nativeView = this.nativeViewProtected; | ||
| 129 | + if (nativeView) { | ||
| 130 | + nativeView.smoothScrollToPosition(index); | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + | ||
| 127 | 134 | get _childrenCount(): number { | |
| 128 | 135 | return this._realizedItems.size; | |
| 129 | 136 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -97,6 +97,14 @@ export class ListView extends View { | |||
| 97 | 97 | */ | |
| 98 | 98 | scrollToIndex(index: number); | |
| 99 | 99 | ||
| 100 | + /** | ||
| 101 | + * Scrolls the specified item with index into view with animation. | ||
| 102 | + * [iOS](https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITableView_Class/#//apple_ref/occ/instm/UITableView/scrollToRowAtIndexPath:atScrollPosition:animated:) | ||
| 103 | + * [Android](https://developer.android.com/reference/android/widget/ListView.html#smoothScrollToPosition(int)) | ||
| 104 | + * @param index - Item index. | ||
| 105 | + */ | ||
| 106 | + scrollToIndexAnimated(index: number); | ||
| 107 | + | ||
| 100 | 108 | /** | |
| 101 | 109 | * Checks if Specified item with index is visible. | |
| 102 | 110 | * @param index - Item index. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -261,6 +261,13 @@ export class ListView extends ListViewBase { | |||
| 261 | 261 | } | |
| 262 | 262 | } | |
| 263 | 263 | ||
| 264 | + public scrollToIndexAnimated(index: number) { | ||
| 265 | + if (this._ios) { | ||
| 266 | + this._ios.scrollToRowAtIndexPathAtScrollPositionAnimated(NSIndexPath.indexPathForItemInSection(index, 0), | ||
| 267 | + UITableViewScrollPosition.Top, true); | ||
| 268 | + } | ||
| 269 | + } | ||
| 270 | + | ||
| 264 | 271 | public refresh() { | |
| 265 | 272 | // clear bindingContext when it is not observable because otherwise bindings to items won't reevaluate | |
| 266 | 273 | this._map.forEach((view, nativeView, map) => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments