-
-
Notifications
You must be signed in to change notification settings - Fork 173
/
Copy pathRNErrorPrompt.ts
38 lines (35 loc) · 1.22 KB
/
RNErrorPrompt.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { QWidget, QErrorMessage, QErrorMessageSignals } from "@nodegui/nodegui";
import { throwUnsupported } from "../../utils/helpers";
import { RNWidget } from "../config";
import { DialogProps, setDialogProps } from "../Dialog/RNDialog";
export interface ErrorPromptProps extends DialogProps<QErrorMessageSignals> {
message: string;
}
function setErrorPromptProps(widget: RNErrorPrompt, newProps: ErrorPromptProps, oldProps: ErrorPromptProps) {
const setter: ErrorPromptProps = {
set message(message: string) {
widget.showMessage(message);
widget.close();
},
};
Object.assign(setter, newProps);
setDialogProps(widget, newProps, oldProps);
}
export class RNErrorPrompt extends QErrorMessage implements RNWidget {
setProps(newProps: ErrorPromptProps, oldProps: ErrorPromptProps): void {
setErrorPromptProps(this, newProps, oldProps);
}
appendInitialChild(child: QWidget<any>): void {
throwUnsupported(this);
}
appendChild(child: QWidget<any>): void {
throwUnsupported(this);
}
insertBefore(child: QWidget<any>, beforeChild: QWidget<any>): void {
throwUnsupported(this);
}
removeChild(child: QWidget<any>): void {
throwUnsupported(this);
}
static tagName = "error-prompt";
}