PromptOptions
What a prompt asks for: an alert's title, message and buttons, plus the kind of text field and its starting text.
Utilização
Choose the input style for a prompt.
Este tipo é usado por prompt
// Choose the input style for a prompt.
import { prompt, type PromptType } from 'kuito';
async function ask(title: string, type: PromptType) {
const answer = await prompt({ title, type });
return answer?.value ?? null;
}
const pin = await ask('Enter your PIN', 'password');
const login = await ask('Sign in to Wi-Fi', 'login'); // { username, password }Declaração do tipo
export type PromptOptions = AlertOptions & {
type?: PromptType;
/** The field's starting text, as TextField's `value`; a login's username. */
value?: string;
/** The keyboard, as TextField's `inputMode`; a password's too, for a PIN. */
inputMode?: Exclude<InputMode, 'none'>;
};Membros 8
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
title | string | Sim | — |
message | string | Não | — |
buttons | readonly AlertButton[] | Não | — |
cancelable | boolean | Não | Android: tapping outside or Back dismisses the alert. False by default. |
colorScheme | "light" | "dark" | Não | iOS: light or dark regardless of the app's appearance, as CSS's color-scheme. |
type | PromptType | Não | — |
value | string | Não | The field's starting text, as TextField's value; a login's username. |
inputMode | "search" | "text" | "email" | "tel" | "url" | "decimal" | "numeric" | Não | The keyboard, as TextField's inputMode; a password's too, for a PIN. |
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.