Skip to content

a tiny React hook which allows you to track state of open/close soft keyboard in mobile

Notifications You must be signed in to change notification settings

straxico/use-detect-keyboard-open

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

use-detect-keyboard-open

sandbox

Edit smoosh-water-ysj3w

install

yarn add use-detect-keyboard-open

or

npm i use-detect-keyboard-open

See it in Action

example

import useDetectKeyboardOpen from "use-detect-keyboard-open";
export default function App() {
  const isKeyboardOpen = useDetectKeyboardOpen();
  return (
    <div>
      <h2>{`soft keyboard is ${isKeyboardOpen ? "open" : "close"}`}</h2>
      <input defaultValue="click here for open keyboard" />
    </div>
  );
}

options

useDetectKeyboardOpen( minKeyboardHighte , defalutValue )

  • defalutValue : boolean
    • for initial value
    • default null
    • optional
  • minKeyboardHighte : number
    • for minimom hight of keyboard for detect is open
    • default 300
    • optional

About

a tiny React hook which allows you to track state of open/close soft keyboard in mobile

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published