From 194cfd3323f6c4514b25e98b72b7a3308757bab3 Mon Sep 17 00:00:00 2001 From: EchoFan Date: Wed, 6 Jan 2021 20:09:43 +0900 Subject: [PATCH] fix https://github.com/joltup/rn-fetch-blob/issues/183 --- polyfill/Blob.js | 5 +++-- polyfill/Fetch.js | 3 ++- polyfill/XMLHttpRequest.js | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/polyfill/Blob.js b/polyfill/Blob.js index 53662a798..2f904cc0d 100644 --- a/polyfill/Blob.js +++ b/polyfill/Blob.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a MIT-style license that can be // found in the LICENSE file. -import RNFetchBlob from '../index.js' +import {NativeModules} from 'react-native'; import fs from '../fs.js' import getUUID from '../utils/uuid' import Log from '../utils/log.js' @@ -11,6 +11,7 @@ import EventTarget from './EventTarget' const log = new Log('Blob') const blobCacheDir = fs.dirs.DocumentDir + '/RNFetchBlob-blobs/' +const RNFetchBlob = NativeModules.RNFetchBlob log.disable() // log.level(3) @@ -291,7 +292,7 @@ export default class Blob extends EventTarget { if(!this._isReference) { return fs.unlink(this._ref).catch((err) => { console.warn(err) - }) + }) } else { return Promise.resolve() diff --git a/polyfill/Fetch.js b/polyfill/Fetch.js index 3ecb5915c..8cc9f08e6 100644 --- a/polyfill/Fetch.js +++ b/polyfill/Fetch.js @@ -1,9 +1,10 @@ -import RNFetchBlob from '../index.js' +import {NativeModules} from 'react-native'; import Log from '../utils/log.js' import fs from '../fs' import unicode from '../utils/unicode' import Blob from './Blob' +const RNFetchBlob = NativeModules.RNFetchBlob const log = new Log('FetchPolyfill') log.disable() diff --git a/polyfill/XMLHttpRequest.js b/polyfill/XMLHttpRequest.js index 9036b2bc8..d52e47e19 100644 --- a/polyfill/XMLHttpRequest.js +++ b/polyfill/XMLHttpRequest.js @@ -2,13 +2,14 @@ // Use of this source code is governed by a MIT-style license that can be // found in the LICENSE file. -import RNFetchBlob from '../index.js' +import {NativeModules} from 'react-native'; import XMLHttpRequestEventTarget from './XMLHttpRequestEventTarget.js' import Log from '../utils/log.js' import Blob from './Blob.js' import ProgressEvent from './ProgressEvent.js' import URIUtil from '../utils/uri' +const RNFetchBlob = NativeModules.RNFetchBlob const log = new Log('XMLHttpRequest') log.disable()