
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
react-native-keyboard-detect
Advanced tools
React Native component to handle keyboard detection and adjust view position.
A React Native component for detecting the keyboard visibility and adjusting the view accordingly. It helps you manage the UI when the keyboard is visible, providing smooth animations for an improved user experience.
npm install react-native-keyboard-detect --save
This project is compatible with iOS, Android, Windows and macOS.
This project supports both the old (paper) and the new architecture (fabric).
This project is compatible with expo.
If any step seems unclear, please create a pull request.
To get started, import and use the KeyboardDetect component in your React Native app. Here’s a step-by-step guide.
import { KeyboardDetect } from 'react-native-keyboard-detect';
Now, wrap the content you want to adjust with KeyboardDetect:
import React from 'react';
import { View, Text, TextInput, Button, StyleSheet } from 'react-native';
import { KeyboardDetect } from 'react-native-keyboard-detect';
const MyComponent = () => {
return (
<KeyboardDetect animationDuration={300}>
<View style={styles.inner}>
<Text style={styles.header}>Login</Text>
<TextInput style={styles.input} placeholder="Username" />
<TextInput style={styles.input} placeholder="Password" />
<Button title="Submit" onPress={() => {}} />
</View>
</KeyboardDetect>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
},
inner: {
padding: 24,
flex: 1,
justifyContent: 'space-around',
},
header: {
fontSize: 36,
fontWeight: 'bold',
textAlign: 'center',
},
input: {
height: 40,
borderColor: '#ccc',
borderBottomWidth: 1,
marginBottom: 12,
paddingLeft: 8,
},
});
export default MyComponent;
| Prop | Type | Default Value | Description |
|---|---|---|---|
animationDuration | number | 200 | Customizable duration (in milliseconds) for the animation when the keyboard shows/hidden. |
children is automatically handled and does not need to be explicitly passed as a prop. The content to be adjusted should be wrapped by the KeyboardDetect component directly.Here’s an example of how you can use KeyboardDetect with some custom props:
<KeyboardDetect animationDuration={300}>
<View style={styles.inner}>
<Text style={styles.header}>Sign In</Text>
<TextInput style={styles.input} placeholder="Email" />
<TextInput style={styles.input} placeholder="Password" secureTextEntry />
<Button title="Login" onPress={() => {}} />
</View>
</KeyboardDetect>
Feel free to contribute by adding more languages or improving the time-based logic. Follow these steps:
MIT
This readme is available in:
👤 Johny Lie
Please ⭐️ this repository if this project helped you!
FAQs
React Native component to handle keyboard detection and adjust view position.
We found that react-native-keyboard-detect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.