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:
Bogdan
2017-08-09 00:24:39 +03:00
committed by Mohamed Hegazy
parent 8072e7b840
commit a608fa5c55
4 changed files with 77 additions and 0 deletions

31
types/react-virtual-keyboard/index.d.ts vendored Normal file
View 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> { }

View File

@@ -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} />);
}
}

View 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
}
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }