From 7ec784cb088b8cd912bdf4cea9d8723d9136a95d Mon Sep 17 00:00:00 2001 From: Piotr Obrebski Date: Fri, 4 Mar 2022 09:51:20 +0100 Subject: [PATCH] feat: add inputRef prop. --- src/index.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index a2a3b07..72fe083 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -17,6 +17,7 @@ export interface CSVReaderProps { inputId?: string inputName?: string inputStyle?: object + inputRef?: React.LegacyRef label?: string | React.ReactNode onError?: (error: Error) => void onFileLoaded: (data: Array, fileInfo: IFileInfo, originalFile?: File) => any @@ -34,6 +35,7 @@ const CSVReader: React.FC = ({ inputId = 'react-csv-reader-input', inputName = 'react-csv-reader-input', inputStyle = {}, + inputRef, label, onError = () => {}, onFileLoaded, @@ -88,6 +90,7 @@ const CSVReader: React.FC = ({ accept={accept} onChange={handleChangeFile} disabled={disabled} + ref={inputRef} /> ) @@ -102,6 +105,7 @@ CSVReader.propTypes = { inputId: PropTypes.string, inputName: PropTypes.string, inputStyle: PropTypes.object, + inputRef: PropTypes.func, label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), onError: PropTypes.func, onFileLoaded: PropTypes.func.isRequired,