Verwendung

Dismiss and observe the keyboard

Dieser Typ wird verwendet von keyboard.watch

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>
  );
}

Typdeklaration

ts
export interface KeyboardFrameEvent {
  /** Where the keyboard ends up; height 0 once it hides. */
  frame: KeyboardFrame;
  /** Milliseconds; 0 when the keyboard does not animate. */
  duration: number;
  /** The native curve: `keyboard` (the system's own), `easeInEaseOut`, `easeIn`, `easeOut` or `linear`. */
  easing: string;
}

Mitglieder 3

NameTypErforderlichBeschreibung
frameKeyboardFrameJaWhere the keyboard ends up; height 0 once it hides.
durationnumberJaMilliseconds; 0 when the keyboard does not animate.
easingstringJaThe native curve: keyboard (the system's own), easeInEaseOut, easeIn, easeOut or linear.
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.