Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

On-screen keyboard with customisable keys and tactile / UI feedback 📱

NotificationsYou must be signed in to change notification settings

lukebrandonfarrell/react-native-screen-keyboard

Repository files navigation

All Contributors

npmnpm licencenpm downloads


Install

To get started install via npm:

 npm install react-native-screen-keyboard

Usage

Import:

import{VirtualKeyboard}from'react-native-screen-keyboard';

Then add it to your code:

<VirtualKeyboardonRef={ref=>(this.keyboard=ref)}keyDown={this.keyDown.bind(this)}/>// Callback function which receives the key pressedkeyDown(key){// Key pressed}

The back and custom key will pass a string, either"back" or"custom" to the keyDown callback.

The<VirtualKeyboard /> also has a number of functions which can be triggered through refs.

  • back() this will execute the back action to delete one character.
  • setText(text) this will set the keyboard text to the given value.
  • displayMessage(message) this will create a popup above thekeyboard displaying the given a message. The style of the popup can be customized through props.
  • clearMessage() this will clear the keyboard message dialog.
  • enable() this will enable the keyboard for input.
  • disable() this will disable the keyboard.

VirtualKeyboard

The<VirtualKeyboard /> uses two arrays to allow you to set keys and define custom functions for each key.

PropTypeOptionalDefaultDescription
onRefanyYesonRef allows you to call thethrowError(message) method.
onKeyDownfunctionYesCallback function triggered when a key is pressed. Returns the key value.
onChangefunctionYesCallback function triggered when a key is pressed. Returns the full string.
onCustomKeyfunctionYesCallback function triggered when custom left button is pressed, use withonChange
onPressFunctionstringYesonPressInDetermines which function to call when the user pressed a key. Could be one of the following three functions:onPress,onPressIn oronPressOut. For an explanation how the functions work take a look at the GitHub page from thereact-native-material-ripple project.
keyboardarrayYesSee VirtualKeyboard.js4 x 3 matrix containing the value for each key. See VirtualKeyboard.js.
keyboardFuncarrayYesSee VirtualKeyboard.js4 x 3 matrix containing custom functions for each key. Pass null for no function.
keyboardCustomKeyImagenumberYesnullImage for the custom key (bottom left key)
keyboardCustomBackKeyelementYesbackAssetElement for the back key (bottom right key)
keyDisabledarrayYesSee VirtualKeyboard.js4 x 3 matrix containing the disabled value for each key. See VirtualKeyboard.js.
keyboardMessageDisplayTimenumberYes3000Time in milliseconds for the message dialog to automatically clear.
vibrationboolYesfalseKey / Tactile vibration enabled
keyboardStyleobjectYesSee VirtualKeyboard.jsStyle applied to the keyboard.
keyboardDisabledStyleobjectYesSee VirtualKeyboard.jsStyle applied when the keyboard is disabled.
keyCustomStylearrayYesSee VirtualKeyboard.js4 x 3 matrix containing a custom style for each key. Pass null for default style or to use keyStyle as an override.
keyStyleobjectYesSee VirtualKeyboard.jsStyle applied to each key on the keyboard.
keyTextStyleobjectYesSee VirtualKeyboard.jsStyle applied to the text inside each key.
keyImageStyleobjectYesSee VirtualKeyboard.jsStyle applied to image in a key. If an image is passed.
messageStyleobjectYesSee VirtualKeyboard.jsStyle applied to popup error. Can set the background colour here.
messageTextStyleobjectYesSee VirtualKeyboard.jsStyle applied to the text inside the popup error.
messageTestIDstringYes"MessageContainer"TestID belonging to the view component of the popup error.
messageTextTestIDstringYes"Message"TestID belonging to the text component inside the popup error.

Contributing

If you want to issue a PR, go ahead ;)

License

This project is licensed under the MIT License

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Luke Brandon Farrell
Luke Brandon Farrell

💻📖🚇
Aike van den Brink
Aike van den Brink

🔣💻📖
Andy Phillipson
Andy Phillipson

💻📖
Leonardo BALLAND
Leonardo BALLAND

💻📖
Tim Van Dijck
Tim Van Dijck

💻

This project follows theall-contributors specification. Contributions of any kind welcome!

About

On-screen keyboard with customisable keys and tactile / UI feedback 📱

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors6


[8]ページ先頭

©2009-2025 Movatter.jp