keyboard
Follows the software keyboard, for layouts and animations that react to it, and dismisses it.
Usage
Dismiss and observe the keyboard
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>
);
}Exports 8
Methods, constants and types exposed by this native namespace.
function
watchCalls listener with each event: willShow, didShow, willHide,
didHide, willChangeFrame or didChangeFrame.typeKeyboardEventNameAn event keyboard.watch takes: willShow, didShow, willHide, didHide, willChangeFrame or didChangeFrame.typeKeyboardFrameThe keyboard's frame on screen, in points.typeKeyboardFrameEventWhat a keyboard event says about the keyboard's motion, for moving views in step with it.valuevisibleWhether the keyboard is on screen: true once it has shown, false once it has hidden.valueframeThe shown keyboard's frame on screen, in points; null while it is hidden.valueheightHow far the keyboard stands over the window's bottom now, in points; 0
while hidden.functiondismissHides the keyboard and blurs the focused input.Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.