feat: Image add isAnimating, startAnimating and stopAnimating API

This commit is contained in:
pengfei.zhou
2021-09-26 16:27:13 +08:00
committed by osborn
parent 3fd8405e0b
commit 63e0d1c38c
13 changed files with 213 additions and 36 deletions

View File

@@ -2154,6 +2154,15 @@ var Image = /** @class */ (function (_super) {
function Image() {
return _super !== null && _super.apply(this, arguments) || this;
}
Image.prototype.isAnimating = function (context) {
return this.nativeChannel(context, "isAnimating")();
};
Image.prototype.startAnimating = function (context) {
return this.nativeChannel(context, "startAnimating")();
};
Image.prototype.stopAnimating = function (context) {
return this.nativeChannel(context, "stopAnimating")();
};
__decorate$a([
Property,
__metadata$a("design:type", String)

View File

@@ -1619,6 +1619,15 @@ exports.ScaleType = void 0;
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
})(exports.ScaleType || (exports.ScaleType = {}));
class Image extends View {
isAnimating(context) {
return this.nativeChannel(context, "isAnimating")();
}
startAnimating(context) {
return this.nativeChannel(context, "startAnimating")();
}
stopAnimating(context) {
return this.nativeChannel(context, "stopAnimating")();
}
}
__decorate$a([
Property,

View File

@@ -3140,6 +3140,15 @@ exports.ScaleType = void 0;
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
})(exports.ScaleType || (exports.ScaleType = {}));
class Image extends View {
isAnimating(context) {
return this.nativeChannel(context, "isAnimating")();
}
startAnimating(context) {
return this.nativeChannel(context, "startAnimating")();
}
stopAnimating(context) {
return this.nativeChannel(context, "stopAnimating")();
}
}
__decorate$a([
Property,

4
doric-js/index.d.ts vendored
View File

@@ -606,6 +606,7 @@ declare module 'doric/lib/src/widget/text' {
declare module 'doric/lib/src/widget/image' {
import { View } from "doric/lib/src/ui/view";
import { Color } from "doric/lib/src/util/color";
import { BridgeContext } from "doric/lib/src/runtime/global";
export enum ScaleType {
ScaleToFill = 0,
ScaleAspectFit = 1,
@@ -674,6 +675,9 @@ declare module 'doric/lib/src/widget/image' {
right: number;
bottom: number;
};
isAnimating(context: BridgeContext): Promise<boolean>;
startAnimating(context: BridgeContext): Promise<any>;
stopAnimating(context: BridgeContext): Promise<any>;
}
export function image(config: Partial<Image>): Image;
}

View File

@@ -1,5 +1,6 @@
import { View } from "../ui/view";
import { Color } from "../util/color";
import { BridgeContext } from "../runtime/global";
export declare enum ScaleType {
ScaleToFill = 0,
ScaleAspectFit = 1,
@@ -68,5 +69,8 @@ export declare class Image extends View {
right: number;
bottom: number;
};
isAnimating(context: BridgeContext): Promise<boolean>;
startAnimating(context: BridgeContext): Promise<any>;
stopAnimating(context: BridgeContext): Promise<any>;
}
export declare function image(config: Partial<Image>): Image;

View File

@@ -32,6 +32,15 @@ export var ScaleType;
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
})(ScaleType || (ScaleType = {}));
export class Image extends View {
isAnimating(context) {
return this.nativeChannel(context, "isAnimating")();
}
startAnimating(context) {
return this.nativeChannel(context, "startAnimating")();
}
stopAnimating(context) {
return this.nativeChannel(context, "stopAnimating")();
}
}
__decorate([
Property,

View File

@@ -16,6 +16,7 @@
import { View, Property } from "../ui/view"
import { layoutConfig } from "../util/layoutconfig"
import { Color } from "../util/color"
import { BridgeContext } from "../runtime/global"
export enum ScaleType {
ScaleToFill = 0,
@@ -107,6 +108,18 @@ export class Image extends View {
right: number,
bottom: number
}
isAnimating(context: BridgeContext) {
return this.nativeChannel(context, "isAnimating")() as Promise<boolean>
}
startAnimating(context: BridgeContext) {
return this.nativeChannel(context, "startAnimating")()
}
stopAnimating(context: BridgeContext) {
return this.nativeChannel(context, "stopAnimating")()
}
}
export function image(config: Partial<Image>) {