From 40473bf833c496ce9431c75544e4c61376a29195 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Thu, 7 Jan 2021 13:28:21 -0500 Subject: [PATCH] landscape/useS3: restore behaviour on ios --- pkg/interface/src/logic/lib/useS3.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/interface/src/logic/lib/useS3.ts b/pkg/interface/src/logic/lib/useS3.ts index b5d4993d5..0717d52f7 100644 --- a/pkg/interface/src/logic/lib/useS3.ts +++ b/pkg/interface/src/logic/lib/useS3.ts @@ -50,11 +50,11 @@ const useS3 = (s3: S3State, { accept = '*' } = { accept: '*' }): IuseS3 => { ACL: "public-read", ContentType: file.type, }; - + setUploading(true); const { Location } = await client.current.upload(params).promise(); - + setUploading(false); return Location; @@ -75,6 +75,7 @@ const useS3 = (s3: S3State, { accept = '*' } = { accept: '*' }): IuseS3 => { const fileSelector = document.createElement('input'); fileSelector.setAttribute('type', 'file'); fileSelector.setAttribute('accept', accept); + fileSelector.style.visibility = 'hidden'; fileSelector.addEventListener('change', () => { const files = fileSelector.files; if (!files || files.length <= 0) { @@ -82,10 +83,12 @@ const useS3 = (s3: S3State, { accept = '*' } = { accept: '*' }): IuseS3 => { return; } uploadDefault(files[0]).then(resolve); + document.body.removeChild(fileSelector); }) + document.body.appendChild(fileSelector); fileSelector.click(); }) - + }, [uploadDefault] );