Closed tesshsu closed 3 years ago
Hi @tesshsu,
Sorry for replying to you late.
I have checked your code and saw that you implemented ImageUpload
component not correctly.
You do not have to have an useState of images because the image state is held and change by react-final-form with the props in {...input}
.
What you should do is removing value
and onChange
in ImgUploadAdapter
like this:
multiple
// value={images}
// onChange={onChange}
maxNumber={maxNumber}
@vutoan266 Tks!! that's working perfectly!! Have a nice day
Hi Team This is great library, somehow in the doc I do not see any prop for submitting ? For example once images all selected, I add submit button allow to send post to API But looking for document there's no relative Props ?
I used react final form to submit formulair `import React from 'react'; import ImageUploading from "react-images-uploading"; import useAnnonces from 'service/hooks/useAnnonces'; import {Field, Form} from 'react-final-form';
export function ImageUpload() { const [images, setImages] = React.useState([]); const [isUpload, setIsUpload] = React.useState(false); const maxNumber = 10; const onChange = (imageList, addUpdateIndex) => { // data for submit console.log(imageList, addUpdateIndex); setImages(imageList); setIsUpload(true); };
}
export default ImageUpload; `
Thanks