0.1.1 • Published 3 years ago

react-native-use-keyboard-height v0.1.1

Weekly downloads
15
License
MIT
Repository
github
Last release
3 years ago

react-native-use-keyboard-height

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

Demo

Installation

npm install react-native-use-keyboard-height

Usage

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();
  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 to learn how to contribute to the repository and the development workflow.

License

MIT