From 784b474217c0ab875225bf96c29c5ed7a95090bb Mon Sep 17 00:00:00 2001 From: Ahmed Sbai Date: Sat, 9 Jan 2021 12:28:47 +0100 Subject: [PATCH] Require cycle refactor fix --- polyfill/Blob.js | 6 ++++-- polyfill/Fetch.js | 4 ++-- polyfill/XMLHttpRequest.js | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/polyfill/Blob.js b/polyfill/Blob.js index 53662a798..51e332225 100644 --- a/polyfill/Blob.js +++ b/polyfill/Blob.js @@ -2,7 +2,8 @@ // 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 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' @@ -10,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 +293,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..43930188a 100644 --- a/polyfill/Fetch.js +++ b/polyfill/Fetch.js @@ -1,9 +1,9 @@ -import RNFetchBlob from '../index.js' import Log from '../utils/log.js' import fs from '../fs' import unicode from '../utils/unicode' import Blob from './Blob' - +import {NativeModules} from 'react-native'; +const RNFetchBlob = NativeModules.RNFetchBlob const log = new Log('FetchPolyfill') log.disable() diff --git a/polyfill/XMLHttpRequest.js b/polyfill/XMLHttpRequest.js index 9036b2bc8..bbb14521b 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 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' +import {NativeModules} from 'react-native'; +const RNFetchBlob = NativeModules.RNFetchBlob const log = new Log('XMLHttpRequest') log.disable()