# react-native-use-keyboard-height

> a simple hook to get keyboard height while it's shown

Latest version **0.1.2** (published 2024-05-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-use-keyboard-height
pnpm add react-native-use-keyboard-height
yarn add react-native-use-keyboard-height
bun add react-native-use-keyboard-height
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2024-05-21 |
| First published | 2021-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | gie |
| Maintainers | gie3d |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/react-native-use-keyboard-height
- Repository: https://github.com/gie3d/react-native-use-keyboard-height
- Homepage: https://github.com/gie3d/react-native-use-keyboard-height#readme
- Issues: https://github.com/gie3d/react-native-use-keyboard-height/issues
- npm.io page: https://npm.io/package/react-native-use-keyboard-height

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2024-05-21
- 0.1.1 — 2021-02-17
- 0.1.0 — 2021-02-17

## README

# react-native-use-keyboard-height

a simple hook to get keyboard height while it's shown in react-native

![Demo](./sample.gif)

## Installation

```sh
npm install react-native-use-keyboard-height
```

## Usage

```js
import React from 'react';
import { StyleSheet, View, Text, TextInput } from 'react-native';
import useKeyboardHeight from 'react-native-use-keyboard-height';

export default function App() {
  const keyboardHeight = useKeyboardHeight(); // both ios and android
  // const keyboardHeight = useKeyboardHeight(['ios', 'android']); // both ios and android
  // const keyboardHeight = useKeyboardHeight(['ios']); // only ios
  // const keyboardHeight = useKeyboardHeight(['android']); // only android
  return (
    <View style={styles.container}>
      <Text>Current Keyboard Height: {keyboardHeight}</Text>
      <TextInput style={styles.input}></TextInput>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  input: {
    width: 300,
    height: 50,
    borderWidth: 1,
    borderColor: 'grey',
    textAlign: 'center',
    marginTop: 10,
  },
});
```

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT

---
_Source: https://npm.io/package/react-native-use-keyboard-height · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
