# dialogs()

```ts
function dialogs(onDialog): HookExtension<HookEvent<"alert" | "confirm" | "prompt", Dialog>>;
```

Answers the page's `alert`, `confirm` and `prompt` with `onDialog` instead of the native dialogs; the page waits for the answer.

Not in react-native-webview, whose dialogs are native.

The return value (a promise is awaited) is the answer: `true` accepts a confirm, a string is a prompt's text, and anything else, a throw too, dismisses the dialog (confirm false, prompt null). An alert's answer doesn't matter.

`signal` aborts when the core stops waiting for the answer, and the dialog is then dismissed; [HookExtension.onAsk](<https://rasmuskard.github.io/react-native-minimal-webview/typescript/react-native-minimal-webview/type-aliases/HookExtension/index.md#onask>) has the rules.

Without this extension, the default dialogs show, as `WebViewProps` describes.

**Parameters**

| Parameter | Type |
| --- | --- |
| `onDialog` | (`dialog`, `signal`) =\> `unknown` |

**Returns**

[`HookExtension`](<https://rasmuskard.github.io/react-native-minimal-webview/typescript/react-native-minimal-webview/type-aliases/HookExtension/index.md>)\<[`HookEvent`](<https://rasmuskard.github.io/react-native-minimal-webview/typescript/react-native-minimal-webview/type-aliases/HookEvent/index.md>)\<`"alert"` | `"confirm"` | `"prompt"`, [`Dialog`](<https://rasmuskard.github.io/react-native-minimal-webview/typescript/extensions/type-aliases/Dialog/index.md>)\>\>
