Keyboard
React Native Hook for Keyboard
Install / Use
/learn @react-native-hooks/KeyboardREADME
@rnhooks/keyboard

React Native hook for keyboard
Installation
yarn add @rnhooks/keyboard
Note
v1.0.0and above is only supported onreact-native >= 0.65, for olderreact-nativeuse the older release.
Usage
import useKeyboard from '@rnhooks/keyboard';
function App() {
const [visible, dismiss] = useKeyboard();
return (
<View style={styles.container}>
<Text style={styles.welcome}>@rnhook/keyboard</Text>
<Text style={styles.instructions}>{visible ? 'Keyboard Visible' : 'Keyboard Not Visible'}</Text>
<Button title="Dismiss Keyboard" onPress={dismiss} />
</View>
);
}
Configuration
If you like, you can configure the hook to use the will events instead of the
did events (by default, it uses the did events). This is useful in cases
where you want to trigger an animation before the keyboard begins dismissing:
useKeyboard({
useWillShow: true,
useWillHide: true,
})
| Name | Default | Type | Description |
| ----------- | ------- | -------:| ----------------------------------------- |
| useWillShow | false | boolean | Use the keyboardWillShow event instead. |
| useWillHide | false | boolean | Use the keyboardWillHide event instead. |
Output
| Name | Default | Type | Description |
| ------- | ------------------- | --------:| ------------------- |
| visible | false | boolean | Keyboard Visibility |
| dismiss | Keyboard.dismiss | function | Dismiss Keyboard |
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
