feat:add switch for Android and iOS

This commit is contained in:
pengfei.zhou
2020-03-13 13:01:21 +08:00
committed by osborn
parent a6df529f8f
commit 4359eec700
23 changed files with 708 additions and 83 deletions

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

@@ -78,6 +78,7 @@ declare module 'doric/lib/src/widget/index.widget' {
export * from 'doric/lib/src/widget/input';
export * from 'doric/lib/src/widget/nestedSlider';
export * from 'doric/lib/src/widget/draggable';
export * from 'doric/lib/src/widget/switch';
}
declare module 'doric/lib/src/native/index.native' {
@@ -498,21 +499,6 @@ declare module 'doric/lib/src/widget/image' {
imageBase64?: string;
scaleType?: ScaleType;
isBlur?: boolean;
placeHolderImage?: string;
placeHolderColor?: Color;
errorImage?: string;
errorColor?: Color;
loadCallback?: (image: {
width: number;
height: number;
} | undefined) => void;
}
export class Image extends View implements IImage {
imageUrl?: string;
imagePath?: string;
imageRes?: string;
scaleType?: ScaleType;
isBlur?: boolean;
/**
* Display while image is loading
* Local file name
@@ -540,6 +526,21 @@ declare module 'doric/lib/src/widget/image' {
height: number;
} | undefined) => void;
}
export class Image extends View implements IImage {
imageUrl?: string;
imagePath?: string;
imageRes?: string;
scaleType?: ScaleType;
isBlur?: boolean;
placeHolderImage?: string;
placeHolderColor?: Color;
errorImage?: string;
errorColor?: Color;
loadCallback?: (image: {
width: number;
height: number;
} | undefined) => void;
}
export function image(config: IImage): Image;
}
@@ -811,6 +812,35 @@ declare module 'doric/lib/src/widget/draggable' {
export function draggable(views: View | View[], config?: IDraggable): Draggable;
}
declare module 'doric/lib/src/widget/switch' {
import { View, IView } from "doric/lib/src/ui/view";
import { Color } from "doric/lib/src/util/color";
export interface ISwitch extends IView {
/**
* True is on ,false is off,defalut is off.
*/
state?: boolean;
/**
* Switch change callback
*/
onSwitch?: (state: boolean) => void;
onTintColor?: Color;
offTintColor?: Color;
thumbTintColor?: Color;
}
export class Switch extends View {
/**
* True is on ,false is off,defalut is off.
*/
state?: boolean;
onSwitch?: (state: boolean) => void;
offTintColor?: Color;
onTintColor?: Color;
thumbTintColor?: Color;
}
export function switchView(config: ISwitch): Switch;
}
declare module 'doric/lib/src/native/modal' {
import { BridgeContext } from "doric/lib/src/runtime/global";
import { Gravity } from "doric/lib/src/util/gravity";