Add missing type attibute to FileComponent (#3481)

This commit is contained in:
Erik Jan de Wit 2022-10-10 18:04:07 +02:00 committed by GitHub
parent b21e2efaf0
commit 066ecbe3e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,6 +18,7 @@ export const FileComponent = ({
const { t } = useTranslation("dynamic"); const { t } = useTranslation("dynamic");
const { control } = useFormContext(); const { control } = useFormContext();
const [filename, setFilename] = useState(""); const [filename, setFilename] = useState("");
const [isLoading, setIsLoading] = useState(false);
return ( return (
<FormGroup <FormGroup
@ -35,8 +36,18 @@ export const FileComponent = ({
<FileUpload <FileUpload
id={name!} id={name!}
value={value} value={value}
type="text"
filename={filename} filename={filename}
isDisabled={isDisabled} isDisabled={isDisabled}
onFileInputChange={(_, file) => setFilename(file.name)}
onReadStarted={() => setIsLoading(true)}
onReadFinished={() => setIsLoading(false)}
onClearClick={() => {
onChange("");
setFilename("");
}}
isLoading={isLoading}
allowEditingUploadedText={false}
onChange={(value, filename) => { onChange={(value, filename) => {
onChange(value); onChange(value);
setFilename(filename); setFilename(filename);