react-simple-keyboard
Advanced tools
Comparing version 1.4.1 to 1.4.2
{ | ||
"name": "react-simple-keyboard", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "React.js Virtual Keyboard", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -298,2 +298,24 @@ [![npm version](https://badge.fury.io/js/react-simple-keyboard.svg)](https://www.npmjs.com/package/react-simple-keyboard) | ||
This is a port of the [simple-keyboard feature](https://www.npmjs.com/package/simple-keyboard#dispatch) of the same name. | ||
If you'd like to use a more react-like approach to sending props to many instances, you can use shared props like so: | ||
```js | ||
let sharedProps = { | ||
layoutName: this.state.layoutName, | ||
onChange: input => this.onChange(input), | ||
onKeyPress: button => this.onKeyPress(button), | ||
}; | ||
// Keyboard 1 | ||
<Keyboard {...sharedProps} /> | ||
// Keyboard 2 | ||
<Keyboard {...sharedProps} /> | ||
``` | ||
This way you can update your desired instances at the same time using `this.setState`. | ||
[![Edit react-simple-keyboard multiple instances demo](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/8z2jw9okm8) | ||
## Q&A / Use-cases | ||
@@ -300,0 +322,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105362
410