import * as React from "react"; interface IFileButtonLineComponentProps { label: string; onClick: (file: File) => void; accept: string; } export class FileButtonLineComponent extends React.Component { private static _IDGenerator = 0; private _id = FileButtonLineComponent._IDGenerator++; private uploadInputRef: React.RefObject; constructor(props: IFileButtonLineComponentProps) { super(props); this.uploadInputRef = React.createRef(); } onChange(evt: any) { var files: File[] = evt.target.files; if (files && files.length) { this.props.onClick(files[0]); } evt.target.value = ""; } render() { return (
this.onChange(evt)} />
); } }