Utilização

Choose the input style for a prompt.

Este tipo é usado por prompt

tsx
// 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

ts
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

NomeTipoObrigatórioDescrição
titlestringSim—
messagestringNão—
buttonsreadonly AlertButton[]Não—
cancelablebooleanNãoAndroid: tapping outside or Back dismisses the alert. False by default.
colorScheme"light" | "dark"NãoiOS: light or dark regardless of the app's appearance, as CSS's color-scheme.
typePromptTypeNão—
valuestringNãoThe field's starting text, as TextField's value; a login's username.
inputMode"search" | "text" | "email" | "tel" | "url" | "decimal" | "numeric"NãoThe 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.