feat: add apply function on Ref
This commit is contained in:
@@ -47,6 +47,7 @@ export function animate(context) {
|
||||
for (let v of map.values()) {
|
||||
if (v.isDirty()) {
|
||||
const model_1 = v.toModel();
|
||||
model_1.duration = args.duration;
|
||||
const ret_1 = context.callNative('animate', 'animateRender', model_1);
|
||||
v.clean();
|
||||
return ret_1;
|
||||
|
3
doric-js/lib/src/ui/view.d.ts
vendored
3
doric-js/lib/src/ui/view.d.ts
vendored
@@ -14,10 +14,12 @@ export declare type NativeViewModel = {
|
||||
[index: string]: Model;
|
||||
};
|
||||
};
|
||||
declare type RefType<T> = T extends Ref<infer R> ? R : never;
|
||||
export declare class Ref<T extends View> {
|
||||
private view?;
|
||||
set current(v: T);
|
||||
get current(): T;
|
||||
apply(config: Partial<RefType<this>>): void;
|
||||
}
|
||||
export declare function createRef<T extends View>(): Ref<T>;
|
||||
export declare abstract class View implements Modeling {
|
||||
@@ -164,3 +166,4 @@ export declare abstract class Group extends Superview implements JSX.ElementChil
|
||||
private addInnerElement;
|
||||
set innerElement(e: View | ViewFragment | ViewFragment[] | undefined | null);
|
||||
}
|
||||
export {};
|
||||
|
@@ -33,6 +33,11 @@ export class Ref {
|
||||
}
|
||||
return this.view;
|
||||
}
|
||||
apply(config) {
|
||||
if (this.view) {
|
||||
this.view.apply(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
export function createRef() {
|
||||
return new Ref;
|
||||
|
Reference in New Issue
Block a user