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

35 lines
783 B
TypeScript
Raw Normal View History

2022-02-28 23:25:18 +05:00
import { eSendEvent } from '../../services/event-manager';
2022-02-28 13:48:59 +05:00
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: any) => void;
onClose?: () => void;
positiveType?:
| 'transparent'
| 'gray'
| 'grayBg'
| 'accent'
| 'inverted'
| 'shade'
| 'error'
| 'errorShade';
icon?: string;
paragraphColor: string;
input: boolean;
inputPlaceholder: string;
defaultValue: string;
context: 'global' | 'local';
};
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
}