feat:Scroller add scrollTo method
This commit is contained in:
@@ -2004,6 +2004,9 @@ var Scroller = /** @class */ (function (_super) {
|
||||
this.dirtyProps.content = this.content.viewId;
|
||||
return _super.prototype.toModel.call(this);
|
||||
};
|
||||
Scroller.prototype.scrollTo = function (context, offset, animated) {
|
||||
return this.nativeChannel(context, "scrollTo")({ offset: offset, animated: animated });
|
||||
};
|
||||
return Scroller;
|
||||
}(Superview));
|
||||
|
||||
|
@@ -1499,6 +1499,9 @@ class Scroller extends Superview {
|
||||
this.dirtyProps.content = this.content.viewId;
|
||||
return super.toModel();
|
||||
}
|
||||
scrollTo(context, offset, animated) {
|
||||
return this.nativeChannel(context, "scrollTo")({ offset, animated });
|
||||
}
|
||||
}
|
||||
|
||||
var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
||||
|
@@ -2958,6 +2958,9 @@ class Scroller extends Superview {
|
||||
this.dirtyProps.content = this.content.viewId;
|
||||
return super.toModel();
|
||||
}
|
||||
scrollTo(context, offset, animated) {
|
||||
return this.nativeChannel(context, "scrollTo")({ offset, animated });
|
||||
}
|
||||
}
|
||||
|
||||
var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
||||
|
5
doric-js/index.d.ts
vendored
5
doric-js/index.d.ts
vendored
@@ -570,6 +570,7 @@ declare module 'doric/lib/src/widget/slider' {
|
||||
|
||||
declare module 'doric/lib/src/widget/scroller' {
|
||||
import { Superview, View, IView, NativeViewModel } from 'doric/lib/src/ui/view';
|
||||
import { BridgeContext } from 'doric/lib/src/runtime/global';
|
||||
export function scroller(content: View, config?: IScroller): Scroller;
|
||||
export interface IScroller extends IView {
|
||||
content?: View;
|
||||
@@ -578,6 +579,10 @@ declare module 'doric/lib/src/widget/scroller' {
|
||||
content: View;
|
||||
allSubviews(): View[];
|
||||
toModel(): NativeViewModel;
|
||||
scrollTo(context: BridgeContext, offset: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, animated?: boolean): Promise<any>;
|
||||
}
|
||||
}
|
||||
|
||||
|
5
doric-js/lib/src/widget/scroller.d.ts
vendored
5
doric-js/lib/src/widget/scroller.d.ts
vendored
@@ -1,4 +1,5 @@
|
||||
import { Superview, View, IView, NativeViewModel } from '../ui/view';
|
||||
import { BridgeContext } from '../runtime/global';
|
||||
export declare function scroller(content: View, config?: IScroller): Scroller;
|
||||
export interface IScroller extends IView {
|
||||
content?: View;
|
||||
@@ -7,4 +8,8 @@ export declare class Scroller extends Superview implements IScroller {
|
||||
content: View;
|
||||
allSubviews(): View[];
|
||||
toModel(): NativeViewModel;
|
||||
scrollTo(context: BridgeContext, offset: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, animated?: boolean): Promise<any>;
|
||||
}
|
||||
|
@@ -34,4 +34,7 @@ export class Scroller extends Superview {
|
||||
this.dirtyProps.content = this.content.viewId;
|
||||
return super.toModel();
|
||||
}
|
||||
scrollTo(context, offset, animated) {
|
||||
return this.nativeChannel(context, "scrollTo")({ offset, animated });
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
import { Superview, View, IView, NativeViewModel } from '../ui/view'
|
||||
import { layoutConfig } from '../util/layoutconfig'
|
||||
import { BridgeContext } from '../runtime/global'
|
||||
|
||||
export function scroller(content: View, config?: IScroller) {
|
||||
return (new Scroller).also(v => {
|
||||
@@ -43,4 +44,8 @@ export class Scroller extends Superview implements IScroller {
|
||||
this.dirtyProps.content = this.content.viewId
|
||||
return super.toModel()
|
||||
}
|
||||
|
||||
scrollTo(context: BridgeContext, offset: { x: number, y: number }, animated?: boolean) {
|
||||
return this.nativeChannel(context, "scrollTo")({ offset, animated })
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user