Utilização

Dismiss and observe the keyboard

tsx
import { Box, Button, Text, VStack, keyboard } from 'kuito';

export default function KeyboardState() {
  keyboard.frame.value; // { screenX, screenY, width, height } or null

  // In a component, until it unmounts; elsewhere, until remove().
  keyboard.watch('didShow', (event) => console.log(event.frame.height, event.duration));

  return (
    <VStack>
      <Text>{keyboard.visible.value ? 'typing' : ''}</Text>
      {/* Rides on the keyboard. */}
      <Box translateY={keyboard.height.map((height) => -height)} />
      <Button onPress={() => keyboard.dismiss()}>Done</Button>
    </VStack>
  );
}

Propriedades e métodos 3

NomeTipoObrigatórioDescrição
valueKeyboardFrameSimA value moves there now; an animation (timing, spring, decay, ...) moves it there.
follows(source: GestureSource | Readable<KeyboardFrame>) => Motion<KeyboardFrame>SimMoves with source on the UI thread, with no code: a gesture's field (drag.x), another motion value or a derived one. Null stops it.
map<U>(fn: (value: KeyboardFrame) => U) => Derived<U>SimA value computed from this one, on the UI thread.
follows — assinaturas de método

Assinaturas

ts
(source: GestureSource | Readable<KeyboardFrame>): Motion<KeyboardFrame>

Parâmetros

NomeTipoObrigatórioDescrição
sourceGestureSource | Readable<KeyboardFrame>Sim—

Devolve

Motion<KeyboardFrame>

map — assinaturas de método

Assinaturas

ts
<U>(fn: (value: KeyboardFrame) => U): Derived<U>

Parâmetros de tipo

NomeRestriçãoPredefinição
U——

Parâmetros

NomeTipoObrigatórioDescrição
fn(value: KeyboardFrame) => USim—

Devolve

Derived<U>

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.