mh-rn-component
Version:
40 lines • 1.64 kB
text/typescript
import { StyleProp, ViewStyle, } from 'react-native';
export type DialogType = {
id?: number,
title?: string,//*标题
width?: number,//*弹窗宽度
message?: string | (() => JSX.Element),//*文本内容
messageAlign?: "center" | "left" | "right",//*文本对其方式 默认center
showConfirmButton?: boolean,//* 是否展示确认按钮
showCancelButton?: boolean,//* 是否展示取消按钮
confirmButtonText?: string,//*确认按钮文案
confirmButtonColor?: string,//*确认按钮颜色
cancelButtonText?: string,//*取消文案
cancelButtonColor?: string,//*取消按钮颜色
fontSizeButtonText?: number,//*按钮文本大小
overlay?: boolean,//*是否显示遮罩层,
overlayStyle?: StyleProp<ViewStyle>,//*自定义遮罩层样式
closeOnClickOverlay?: boolean,//*是否点击遮罩层关闭弹窗
style?: StyleProp<ViewStyle>,//*弹窗样式
zIndex?: number | string,
customButton?: () => JSX.Element,//* 自定义按钮
customTitle?: () => JSX.Element,//* 自定义头部
confirm?: () => void,//*确认事件
cancel?: () => void,///*取消事件
children?: any,
beforeClose?: (action: string) => boolean | Promise<boolean>,//todo 异步关闭的回调
lazyRender?: boolean,//todo 是否在显示弹层时才渲染节点
}
export type DialogList = {
[key in any]:DialogType
}
export type VisibleDialogsType = {
[key in string]: boolean;
}
export type DialogContextType = {
dialogList: any,
visibleDialogs: VisibleDialogsType,
setDialog: (props: DialogType) => any// todo 暂时用any代替 深入调整后在换
hideDialog: (id:any) => void,
hideAll:()=>void
}