From 8fc71dfcc7218ad8fb98508d26635e73dec6d627 Mon Sep 17 00:00:00 2001 From: dmitryrogozhny Date: Thu, 28 Jul 2016 17:43:59 +0300 Subject: [PATCH] Added definition for react-file-input React component (#10325) * Added definition for react-file-input React component * Added newline at end of file --- react-file-input/react-file-input-tests.tsx | 27 +++++++++++++++++++++ react-file-input/react-file-input.d.ts | 24 ++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 react-file-input/react-file-input-tests.tsx create mode 100644 react-file-input/react-file-input.d.ts diff --git a/react-file-input/react-file-input-tests.tsx b/react-file-input/react-file-input-tests.tsx new file mode 100644 index 0000000000..208a8d29ed --- /dev/null +++ b/react-file-input/react-file-input-tests.tsx @@ -0,0 +1,27 @@ +/// +/// + +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 ( +
+ + + ); + } +} diff --git a/react-file-input/react-file-input.d.ts b/react-file-input/react-file-input.d.ts new file mode 100644 index 0000000000..ca0cac594b --- /dev/null +++ b/react-file-input/react-file-input.d.ts @@ -0,0 +1,24 @@ +// Type definitions for react-file-input +// Project: https://www.npmjs.com/package/react-file-input +// Definitions by: Dmitry Rogozhny +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +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 { + } + + export = FileInput; +}