Added definition for react-file-input React component (#10325)

* Added definition for react-file-input React component

* Added newline at end of file
This commit is contained in:
dmitryrogozhny
2016-07-28 23:43:59 +09:00
committed by Masahiro Wakame
parent 58b0deb938
commit 8fc71dfcc7
2 changed files with 51 additions and 0 deletions
@@ -0,0 +1,27 @@
///<reference path="../react/react.d.ts" />
///<reference path="./react-file-input.d.ts" />
import * as React from "react";
import FileInput = require('react-file-input');
class Form extends React.Component<{}, {}> {
handleChange = (event: React.SyntheticEvent) => {
const target: any = event.target;
console.log('Selected file:', target.files[0]);
}
render(): React.ReactElement<{}> {
return (
<form>
<FileInput
name="myImage"
accept=".png,.gif"
placeholder="My Image"
className="inputClass"
disabled={false}
onChange={this.handleChange}
/>
</form>
);
}
}
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for react-file-input
// Project: https://www.npmjs.com/package/react-file-input
// Definitions by: Dmitry Rogozhny <https://github.com/dmitryrogozhny>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../react/react.d.ts" />
declare module "react-file-input" {
import React = __React;
interface FileInputProps {
name: string;
className: string;
accept: string;
placeholder: string;
disabled?: boolean;
onChange: (event: React.SyntheticEvent) => void;
}
class FileInput extends React.Component<FileInputProps, {}> {
}
export = FileInput;
}