Files
notesnook/apps/mobile/app/components/dialog/functions.ts

35 lines
787 B
TypeScript
Raw Normal View History

import { eSendEvent } from "../../services/event-manager";
import { eCloseSimpleDialog, eOpenSimpleDialog } from "../../utils/events";
type DialogInfo = {
2022-01-22 12:57:05 +05:00
title?: string;
paragraph?: string;
positiveText?: string;
negativeText?: string;
positivePress?: (value: unknown) => void;
2022-01-22 12:57:05 +05:00
onClose?: () => void;
positiveType?:
| "transparent"
| "gray"
| "grayBg"
| "accent"
| "inverted"
| "shade"
| "error"
| "errorShade";
2022-01-22 12:57:05 +05:00
icon?: string;
paragraphColor: string;
input: boolean;
inputPlaceholder: string;
defaultValue: string;
context: "global" | "local";
2022-01-22 12:57:05 +05:00
};
2022-02-08 15:44:13 +05:00
export function presentDialog(data: Partial<DialogInfo>): void {
eSendEvent(eOpenSimpleDialog, data);
}
export function hideDialog(): void {
eSendEvent(eCloseSimpleDialog);
2022-01-22 12:57:05 +05:00
}