mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-04 19:42:46 +08:00
new definition for 'react-virtual-keyboardl' (#18517)
* new definition for 'react-virtual-keyboardl' * err * err * err * add examples from https://www.npmjs.com/package/react-virtual-keyboard * err
This commit is contained in:
31
types/react-virtual-keyboard/index.d.ts
vendored
Normal file
31
types/react-virtual-keyboard/index.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// Type definitions for react-virtual-keyboard 1.0
|
||||
// Project: https://www.npmjs.com/package/react-virtual-keyboard
|
||||
// Definitions by: Bogdan Surai <https://github.com/bsurai>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import { Component } from "react";
|
||||
import { KeyboardOptions, NavigateOptions } from "virtual-keyboard";
|
||||
|
||||
export interface ReactKeyboardOptions extends KeyboardOptions {
|
||||
accepted?: undefined; // You should use KeyboardProps.onAccepted event.
|
||||
}
|
||||
|
||||
export type kbEvents = (event?: string | Event, keyboard?: Element, el?: Element) => void;
|
||||
|
||||
export interface KeyboardProps {
|
||||
name?: string;
|
||||
value?: string;
|
||||
options?: ReactKeyboardOptions;
|
||||
onAccepted?: kbEvents;
|
||||
onChange?: kbEvents;
|
||||
callbackParent?: kbEvents;
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
export interface KeyboardState {
|
||||
value: string;
|
||||
className: string;
|
||||
}
|
||||
|
||||
export default class Keyboard extends Component<KeyboardProps, KeyboardState> { }
|
||||
@@ -0,0 +1,21 @@
|
||||
import * as React from "react";
|
||||
import Keyboard from "react-virtual-keyboard";
|
||||
import { ReactKeyboardOptions } from "react-virtual-keyboard";
|
||||
|
||||
export interface KbState {
|
||||
textarea: string;
|
||||
}
|
||||
|
||||
export default class MyKeyboard extends React.Component<{}, KbState> {
|
||||
onTextareaChanged = (newState: string) => {
|
||||
this.setState({ textarea: newState });
|
||||
}
|
||||
|
||||
render() {
|
||||
return (<Keyboard
|
||||
value={ this.state.textarea }
|
||||
name='thetextareaname'
|
||||
options={{type: 'textarea', layout: 'qwerty', autoAccept: true, alwaysOpen: false, appendLocally: true, color: 'light', class: 'sxcycx', updateOnChange: true }}
|
||||
callbackParent={this.onTextareaChanged} />);
|
||||
}
|
||||
}
|
||||
24
types/react-virtual-keyboard/tsconfig.json
Normal file
24
types/react-virtual-keyboard/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-virtual-keyboard-tests.tsx"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"jsx": "react",
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
1
types/react-virtual-keyboard/tslint.json
Normal file
1
types/react-virtual-keyboard/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user