Skip to content

Commit 7ec784c

Browse files
committed
feat: add inputRef prop.
1 parent 0ddff6e commit 7ec784c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface CSVReaderProps {
1717
inputId?: string
1818
inputName?: string
1919
inputStyle?: object
20+
inputRef?: React.LegacyRef<HTMLInputElement>
2021
label?: string | React.ReactNode
2122
onError?: (error: Error) => void
2223
onFileLoaded: (data: Array<any>, fileInfo: IFileInfo, originalFile?: File) => any
@@ -34,6 +35,7 @@ const CSVReader: React.FC<CSVReaderProps> = ({
3435
inputId = 'react-csv-reader-input',
3536
inputName = 'react-csv-reader-input',
3637
inputStyle = {},
38+
inputRef,
3739
label,
3840
onError = () => {},
3941
onFileLoaded,
@@ -88,6 +90,7 @@ const CSVReader: React.FC<CSVReaderProps> = ({
8890
accept={accept}
8991
onChange={handleChangeFile}
9092
disabled={disabled}
93+
ref={inputRef}
9194
/>
9295
</div>
9396
)
@@ -102,6 +105,7 @@ CSVReader.propTypes = {
102105
inputId: PropTypes.string,
103106
inputName: PropTypes.string,
104107
inputStyle: PropTypes.object,
108+
inputRef: PropTypes.func,
105109
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
106110
onError: PropTypes.func,
107111
onFileLoaded: PropTypes.func.isRequired,

0 commit comments

Comments
 (0)