Parcourir la source

Fix AWS S3 upload on React Native (#3064)

* Fix AWS S3 upload on React Native

* Update packages/@uppy/aws-s3/src/MiniXHRUpload.js

* Update packages/@uppy/aws-s3/src/MiniXHRUpload.js

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>

* Update MiniXHRUpload.js

Co-authored-by: Artur Paikin <artur@arturpaikin.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Charles C il y a 3 ans
Parent
commit
98401279b1
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      packages/@uppy/aws-s3/src/MiniXHRUpload.js

+ 3 - 2
packages/@uppy/aws-s3/src/MiniXHRUpload.js

@@ -211,8 +211,9 @@ module.exports = class MiniXHRUpload {
 
       xhr.open(opts.method.toUpperCase(), opts.endpoint, true)
       // IE10 does not allow setting `withCredentials` and `responseType`
-      // before `open()` is called.
-      xhr.withCredentials = opts.withCredentials
+      // before `open()` is called. It’s important to set withCredentials
+      // to a boolean, otherwise React Native crashes
+      xhr.withCredentials = Boolean(opts.withCredentials)
       if (opts.responseType !== '') {
         xhr.responseType = opts.responseType
       }