feat:List add scrollToItem method
This commit is contained in:
3
doric-js/lib/src/widget/list.d.ts
vendored
3
doric-js/lib/src/widget/list.d.ts
vendored
@@ -1,5 +1,6 @@
|
||||
import { View, Superview, NativeViewModel } from "../ui/view";
|
||||
import { Stack } from "./layouts";
|
||||
import { BridgeContext } from "../runtime/global";
|
||||
export declare class ListItem extends Stack {
|
||||
/**
|
||||
* Set to reuse native view
|
||||
@@ -24,6 +25,8 @@ export declare class List extends Superview {
|
||||
x: number;
|
||||
y: number;
|
||||
}) => void;
|
||||
scrolledPosition?: number;
|
||||
scrollToItem(context: BridgeContext, pos: number, animated?: boolean): Promise<any>;
|
||||
reset(): void;
|
||||
private getItem;
|
||||
isDirty(): boolean;
|
||||
|
@@ -47,6 +47,9 @@ export class List extends Superview {
|
||||
return this.cachedViews.values();
|
||||
}
|
||||
}
|
||||
scrollToItem(context, pos, animated) {
|
||||
return this.nativeChannel(context, 'scrollToItem')({ pos, animated });
|
||||
}
|
||||
reset() {
|
||||
this.cachedViews.clear();
|
||||
this.itemCount = 0;
|
||||
@@ -111,6 +114,10 @@ __decorate([
|
||||
Property,
|
||||
__metadata("design:type", Function)
|
||||
], List.prototype, "onScrollEnd", void 0);
|
||||
__decorate([
|
||||
Property,
|
||||
__metadata("design:type", Number)
|
||||
], List.prototype, "scrolledPosition", void 0);
|
||||
export function list(config) {
|
||||
const ret = new List;
|
||||
for (let key in config) {
|
||||
|
Reference in New Issue
Block a user