diff --git a/patches/react-native+0.71.8.patch b/patches/react-native+0.71.8.patch new file mode 100644 index 0000000..3de9453 --- /dev/null +++ b/patches/react-native+0.71.8.patch @@ -0,0 +1,51 @@ +diff --git a/node_modules/react-native/Libraries/Blob/FileReader.js b/node_modules/react-native/Libraries/Blob/FileReader.js +index 57b3093..e1fef89 100644 +--- a/node_modules/react-native/Libraries/Blob/FileReader.js ++++ b/node_modules/react-native/Libraries/Blob/FileReader.js +@@ -12,6 +12,8 @@ import type Blob from './Blob'; + + import NativeFileReaderModule from './NativeFileReaderModule'; + ++import { toByteArray } from 'base64-js'; ++ + const EventTarget = require('event-target-shim'); + + type ReadyState = +@@ -74,8 +76,35 @@ class FileReader extends (EventTarget(...READER_EVENTS): any) { + } + } + +- readAsArrayBuffer(): any { +- throw new Error('FileReader.readAsArrayBuffer is not implemented'); ++ readAsArrayBuffer(blob: ?Blob): any { ++ this._aborted = false; ++ ++ if (blob == null) { ++ throw new TypeError( ++ "Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'", ++ ); ++ } ++ ++ NativeFileReaderModule.readAsDataURL(blob.data).then( ++ (text: string) => { ++ if (this._aborted) { ++ return; ++ } ++ ++ const base64 = text.split(',')[1]; ++ const typedArray = toByteArray(base64); ++ ++ this._result = typedArray.buffer; ++ this._setReadyState(DONE); ++ }, ++ error => { ++ if (this._aborted) { ++ return; ++ } ++ this._error = error; ++ this._setReadyState(DONE); ++ }, ++ ); + } + + readAsDataURL(blob: ?Blob): void {