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

@@ -17,6 +17,7 @@
import { View, Property, Superview, NativeViewModel } from "../ui/view";
import { Stack } from "./layouts";
import { layoutConfig } from "../util/layoutconfig";
import { BridgeContext } from "../runtime/global";
export class ListItem extends Stack {
@@ -63,6 +64,13 @@ export class List extends Superview {
@Property
onScrollEnd?: (offset: { x: number, y: number }) => void
@Property
scrolledPosition?: number
scrollToItem(context: BridgeContext, pos: number, animated?: boolean) {
return this.nativeChannel(context, 'scrollToItem')({ pos, animated }) as Promise<any>
}
reset() {
this.cachedViews.clear()
this.itemCount = 0