feat:scroller add onScroll and onScrollEnd property

This commit is contained in:
pengfei.zhou
2020-03-03 15:51:20 +08:00
committed by osborn
parent 0fa121e54f
commit 021fdab35f
16 changed files with 141 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ export declare abstract class ViewModel<M extends Object, V extends ViewHolder>
private viewHolder;
constructor(obj: M, v: V);
getState(): M;
getViewHolder(): V;
updateState(setter: Setter<M>): void;
attach(view: Group): void;
abstract onAttached(state: M, vh: V): void;

View File

@@ -9,6 +9,9 @@ export class ViewModel {
getState() {
return this.state;
}
getViewHolder() {
return this.viewHolder;
}
updateState(setter) {
setter(this.state);
this.onBind(this.state, this.viewHolder);

View File

@@ -14,6 +14,14 @@ export declare class Scroller extends Superview implements IScroller {
x: number;
y: number;
};
onScroll?: (offset: {
x: number;
y: number;
}) => void;
onScrollEnd?: (offset: {
x: number;
y: number;
}) => void;
allSubviews(): View[];
toModel(): NativeViewModel;
scrollTo(context: BridgeContext, offset: {

View File

@@ -54,3 +54,11 @@ __decorate([
Property,
__metadata("design:type", Object)
], Scroller.prototype, "contentOffset", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Scroller.prototype, "onScroll", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0);