feat:scroller add onScroll and onScrollEnd property
This commit is contained in:
@@ -2029,6 +2029,14 @@ var Scroller = /** @class */ (function (_super) {
|
||||
Property,
|
||||
__metadata$7("design:type", Object)
|
||||
], Scroller.prototype, "contentOffset", void 0);
|
||||
__decorate$7([
|
||||
Property,
|
||||
__metadata$7("design:type", Function)
|
||||
], Scroller.prototype, "onScroll", void 0);
|
||||
__decorate$7([
|
||||
Property,
|
||||
__metadata$7("design:type", Function)
|
||||
], Scroller.prototype, "onScrollEnd", void 0);
|
||||
return Scroller;
|
||||
}(Superview));
|
||||
|
||||
@@ -3040,6 +3048,9 @@ var ViewModel = /** @class */ (function () {
|
||||
ViewModel.prototype.getState = function () {
|
||||
return this.state;
|
||||
};
|
||||
ViewModel.prototype.getViewHolder = function () {
|
||||
return this.viewHolder;
|
||||
};
|
||||
ViewModel.prototype.updateState = function (setter) {
|
||||
setter(this.state);
|
||||
this.onBind(this.state, this.viewHolder);
|
||||
|
@@ -1510,6 +1510,14 @@ __decorate$7([
|
||||
Property,
|
||||
__metadata$7("design:type", Object)
|
||||
], Scroller.prototype, "contentOffset", void 0);
|
||||
__decorate$7([
|
||||
Property,
|
||||
__metadata$7("design:type", Function)
|
||||
], Scroller.prototype, "onScroll", void 0);
|
||||
__decorate$7([
|
||||
Property,
|
||||
__metadata$7("design:type", Function)
|
||||
], Scroller.prototype, "onScrollEnd", void 0);
|
||||
|
||||
var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
@@ -2258,6 +2266,9 @@ class ViewModel {
|
||||
getState() {
|
||||
return this.state;
|
||||
}
|
||||
getViewHolder() {
|
||||
return this.viewHolder;
|
||||
}
|
||||
updateState(setter) {
|
||||
setter(this.state);
|
||||
this.onBind(this.state, this.viewHolder);
|
||||
|
@@ -2969,6 +2969,14 @@ __decorate$7([
|
||||
Property,
|
||||
__metadata$7("design:type", Object)
|
||||
], Scroller.prototype, "contentOffset", void 0);
|
||||
__decorate$7([
|
||||
Property,
|
||||
__metadata$7("design:type", Function)
|
||||
], Scroller.prototype, "onScroll", void 0);
|
||||
__decorate$7([
|
||||
Property,
|
||||
__metadata$7("design:type", Function)
|
||||
], Scroller.prototype, "onScrollEnd", void 0);
|
||||
|
||||
var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
@@ -3717,6 +3725,9 @@ class ViewModel {
|
||||
getState() {
|
||||
return this.state;
|
||||
}
|
||||
getViewHolder() {
|
||||
return this.viewHolder;
|
||||
}
|
||||
updateState(setter) {
|
||||
setter(this.state);
|
||||
this.onBind(this.state, this.viewHolder);
|
||||
|
9
doric-js/index.d.ts
vendored
9
doric-js/index.d.ts
vendored
@@ -587,6 +587,14 @@ declare module 'doric/lib/src/widget/scroller' {
|
||||
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: {
|
||||
@@ -1139,6 +1147,7 @@ declare module 'doric/lib/src/pattern/mvvm' {
|
||||
export abstract class ViewModel<M extends Object, V extends 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;
|
||||
|
1
doric-js/lib/src/pattern/mvvm.d.ts
vendored
1
doric-js/lib/src/pattern/mvvm.d.ts
vendored
@@ -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;
|
||||
|
@@ -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);
|
||||
|
8
doric-js/lib/src/widget/scroller.d.ts
vendored
8
doric-js/lib/src/widget/scroller.d.ts
vendored
@@ -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: {
|
||||
|
@@ -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);
|
||||
|
@@ -35,6 +35,10 @@ export abstract class ViewModel<M extends Object, V extends ViewHolder> {
|
||||
return this.state
|
||||
}
|
||||
|
||||
getViewHolder() {
|
||||
return this.viewHolder;
|
||||
}
|
||||
|
||||
updateState(setter: Setter<M>) {
|
||||
setter(this.state)
|
||||
this.onBind(this.state, this.viewHolder)
|
||||
|
@@ -40,6 +40,12 @@ export class Scroller extends Superview implements IScroller {
|
||||
@Property
|
||||
contentOffset?: { x: number, y: number }
|
||||
|
||||
@Property
|
||||
onScroll?: (offset: { x: number, y: number }) => void
|
||||
|
||||
@Property
|
||||
onScrollEnd?: (offset: { x: number, y: number }) => void
|
||||
|
||||
allSubviews() {
|
||||
return [this.content]
|
||||
}
|
||||
|
Reference in New Issue
Block a user