Coder Social home page Coder Social logo

ed1son67 / react-native-use-keyboard-height Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gie3d/react-native-use-keyboard-height

0.0 0.0 0.0 865 KB

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

License: MIT License

JavaScript 60.14% TypeScript 39.86%

react-native-use-keyboard-height's Introduction

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

License

MIT

react-native-use-keyboard-height's People

Contributors

gie3d avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.