KeyboardEventName
A keyboard event the runtime listens for: willShow, didShow, willHide, didHide, willChangeFrame or didChangeFrame.
Utilização
Dismiss and observe the keyboard
Este tipo é usado por 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>
);
}Declaração do tipo
export type KeyboardEventName =
| 'willShow'
| 'didShow'
| 'willHide'
| 'didHide'
| 'willChangeFrame'
| 'didChangeFrame';Tipo
"willShow" | "didShow" | "willHide" | "didHide" | "willChangeFrame" | "didChangeFrame"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.