GetStream / stream-chat-react

React Chat SDK ➜ Stream Chat 💬
https://getstream.io/chat/sdk/react/
Other
702 stars 273 forks source link

bug: Sending two files (image / file) is not possible for ios and android #2466

Closed MrMole96 closed 2 months ago

MrMole96 commented 2 months ago

Describe the bug

Attaching files and images in one selection and then sending is not possible. Only image is sent

To Reproduce Input

  const {
    handleSubmit,
    numberOfUploads,
    uploadNewFiles,
    maxFilesLeft,
    isUploadEnabled,
    text,
  } = useMessageInputContext();

const handleChange = (event: any) => {
    const files = event.target.files;
    uploadNewFiles(files);
  };

  ...
    <input
              title="Attach files"
              type="file"
              id="file"
              ref={inputFile}
              multiple
              onClick={() => {
                if (inputFile && inputFile.current)
                  inputFile.current.value = "";
              }}
              onChange={handleChange}
              style={{ display: "none" }}
            />
            ...
              <div
              onClick={(e) => {
                handleSubmit(e);
                inputFocusedRef.current = false;
              }}
              }}
            >
              <Send className="cursor-pointer" />
            </div>

FYI: I used this trick because we couldn't add two times same file. Like you attack file, then click X then add same file again and we didn't see this file

  onClick={() => {
                if (inputFile && inputFile.current)
                  inputFile.current.value = "";
              }}

https://github.com/user-attachments/assets/eca03b7d-7a95-4abf-b0c7-d11ffb2c1d9a

https://github.com/user-attachments/assets/5bf08ba2-adff-49fe-9e3e-bc1415b2c905

Expected behavior

Should be able to send multiple type files in one go

Screenshots

If applicable, add screenshots to help explain your problem.

Package version