Skip to content

Commit

Permalink
feat: add inputRef prop.
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrObrebski committed Mar 4, 2022
1 parent 0ddff6e commit 7ec784c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface CSVReaderProps {
inputId?: string
inputName?: string
inputStyle?: object
inputRef?: React.LegacyRef<HTMLInputElement>
label?: string | React.ReactNode
onError?: (error: Error) => void
onFileLoaded: (data: Array<any>, fileInfo: IFileInfo, originalFile?: File) => any
Expand All @@ -34,6 +35,7 @@ const CSVReader: React.FC<CSVReaderProps> = ({
inputId = 'react-csv-reader-input',
inputName = 'react-csv-reader-input',
inputStyle = {},
inputRef,
label,
onError = () => {},
onFileLoaded,
Expand Down Expand Up @@ -88,6 +90,7 @@ const CSVReader: React.FC<CSVReaderProps> = ({
accept={accept}
onChange={handleChangeFile}
disabled={disabled}
ref={inputRef}
/>
</div>
)
Expand All @@ -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,
Expand Down

0 comments on commit 7ec784c

Please sign in to comment.