keyboard.KeyboardFrameEvent
What a keyboard event says about the keyboard's motion, for moving views in step with it.
Utilisation
Dismiss and observe the keyboard
Ce type est utilisé par keyboard.watch
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>
);
}Déclaration du type
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;
}Membres 3
| Nom | Type | Requis | Description |
|---|---|---|---|
frame | KeyboardFrame | Oui | Where the keyboard ends up; height 0 once it hides. |
duration | number | Oui | Milliseconds; 0 when the keyboard does not animate. |
easing | string | Oui | The native curve: keyboard (the system's own), easeInEaseOut, easeIn, easeOut or linear. |
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.