Usage with React Aria's FileTrigger #592
Unanswered
amosbastian
asked this question in
Q&A
Replies: 2 comments 5 replies
-
same issue I did some custom code deal this issue const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
if (!e.target.files) return
const newFiles = Array.from(e.target.files)
form.update({
name: field.name,
// @ts-expect-error conform-to types are not up to date
files: newFiles,
})
const fileList = new DataTransfer()
newFiles.forEach((file) => fileList.items.add(file))
inputRef.current!.files = fileList.files
setFiles(newFiles)
}
<input
{...getInputProps(field, { type: "file" })}
ref={inputRef}
onChange={onChange}
className="hidden"
multiple={multiple}
accept={accept}
/> IMO: The inputControl.change only can change value, but the |
Beta Was this translation helpful? Give feedback.
4 replies
-
I would expect the If it doesn't work, please create a simple repo on stackblitz or codesandbox so I can take a deeper look. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to use this library with React Aria's FileTrigger
I was thinking I could just do something like
But the
useInputControl
line gives the errorHow else should I implement this?
Beta Was this translation helpful? Give feedback.
All reactions