From 07f3d85f70b70a80bead49fc850ad84efa7de551 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Thu, 21 Jan 2021 18:04:50 +0000 Subject: [PATCH] windows: import rn-fetch-blob on Windows Import rn-fetch-blob on all supported OSes. --- index.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 6c2480a3..4384443b 100644 --- a/index.js +++ b/index.js @@ -21,15 +21,18 @@ import { import { ProgressBar } from '@react-native-community/progress-bar-android' import { ProgressView } from '@react-native-community/progress-view' -let RNFetchBlob = { - fs : { - dirs: { - CacheDir: '' - } - } -}; -if (Platform.OS !== 'windows') { +let RNFetchBlob; +try { RNFetchBlob = require('rn-fetch-blob').default; +} catch(e) { + // For Windows, when not using rn-fetch-blob with Windows support. + RNFetchBlob = { + fs : { + dirs: { + CacheDir: '' + } + } + }; } const SHA1 = require('crypto-js/sha1');