mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 12:11:47 +00:00
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:
committed by
Masahiro Wakame
parent
58b0deb938
commit
8fc71dfcc7
@@ -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
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user