Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 330bb2a

Browse files
authored
Merge pull request billmalarky#30 from adamivancza/master
Replaced 'react-native-fetch-blob' dependency with 'rn-fetch-blob'
2 parents a2880e9 + 0425d83 commit 330bb2a

File tree

8 files changed

+31
-31
lines changed

8 files changed

+31
-31
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ Or
2525
$ yarn add react-native-image-cache-hoc
2626
```
2727

28-
Then, because this package has a depedency on [react-native-fetch-blob](https://github.com/wkh237/react-native-fetch-blob) you will need to link this native package by running:
28+
Then, because this package has a depedency on [rn-fetch-blob](https://github.com/joltup/rn-fetch-blob) you will need to link this native package by running:
2929

3030
```bash
31-
$ react-native link react-native-fetch-blob
31+
$ react-native link rn-fetch-blob
3232
```
3333

34-
Linking react-native-fetch-blob **should only be done once**, reinstalling node_modules with npm or yarn does not require running the above command again.
34+
Linking rn-fetch-blob **should only be done once**, reinstalling node_modules with npm or yarn does not require running the above command again.
3535

36-
To troubleshoot linking, refer to [the react-native-fetch-blob installation instructions](https://github.com/wkh237/react-native-fetch-blob#user-content-installation).
36+
To troubleshoot linking, refer to [the rn-fetch-blob installation instructions](https://github.com/joltup/rn-fetch-blob#user-content-installation).
3737

3838
## Usage
3939

lib/FileSystem.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import { Platform } from 'react-native';
1111
import pathLib from 'path';
12-
import RNFetchBlob from 'react-native-fetch-blob';
12+
import RNFetchBlob from 'rn-fetch-blob';
1313
import sha1 from 'crypto-js/sha1';
1414
import URL from 'url-parse';
1515

@@ -78,7 +78,7 @@ export class FileSystem {
7878
*
7979
* Apple:
8080
* Apple requires non-user generated files to be stored in cache dir, they can be flagged to persist. https://developer.apple.com/icloud/documentation/data-storage/index.html
81-
* it appears reactNativeFetchBlob will flag these files to persist behind the scenes, so cache dir is safe on apple. See: https://www.npmjs.com/package/react-native-fetch-blob#cache-file-management
81+
* it appears reactNativeFetchBlob will flag these files to persist behind the scenes, so cache dir is safe on apple. See: https://www.npmjs.com/package/rn-fetch-blob#cache-file-management
8282
*
8383
* Android:
8484
* Android appears to purge cache dir files so we should use document dir to play it safe (even with reactNativeFetchBlob abstraction) : https://developer.android.com/guide/topics/data/data-storage.html
@@ -119,7 +119,7 @@ export class FileSystem {
119119

120120
/**
121121
*
122-
* Wrapper for https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#existspathstringpromise
122+
* Wrapper for https://github.com/joltup/rn-fetch-blob/wiki/File-System-Access-API#existspathstringpromise
123123
*
124124
* @param path - local relative file path.
125125
* @returns {Promise} - boolean promise for if file exists at path or not.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"crypto-js": "^3.1.9-1",
5656
"path": "^0.12.7",
5757
"prop-types": "^15.6.0",
58-
"react-native-fetch-blob": "0.10.8",
58+
"rn-fetch-blob": "0.10.13",
5959
"react-native-uuid": "^1.4.9",
6060
"traverse": "^0.6.6",
6161
"url-parse": "^1.2.0",

tests/CacheableImage.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ describe('CacheableImage', function() {
9393
it('#cacheFile static method should work as expected for cache dir files.', () => {
9494

9595
// RNFetchBlob Mocks
96-
const RNFetchBlob = require('react-native-fetch-blob');
96+
const RNFetchBlob = require('rn-fetch-blob');
9797

9898
// Mock that file does not exist on local fs.
9999
RNFetchBlob.fs.exists
@@ -125,7 +125,7 @@ describe('CacheableImage', function() {
125125
it('#cacheFile static method should work as expected for permanent dir files.', () => {
126126

127127
// RNFetchBlob Mocks
128-
const RNFetchBlob = require('react-native-fetch-blob');
128+
const RNFetchBlob = require('rn-fetch-blob');
129129

130130
// Mock that file does not exist on local fs.
131131
RNFetchBlob.fs.exists
@@ -157,7 +157,7 @@ describe('CacheableImage', function() {
157157
it('#flush static method should work as expected.', () => {
158158

159159
// RNFetchBlob Mocks
160-
const RNFetchBlob = require('react-native-fetch-blob');
160+
const RNFetchBlob = require('rn-fetch-blob');
161161

162162
// Mock unlink to always be true.
163163
RNFetchBlob.fs.unlink

tests/FileSystem.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('lib/FileSystem', function() {
7474

7575
it('#exists mocked as true.', () => {
7676

77-
const RNFetchBlob = require('react-native-fetch-blob');
77+
const RNFetchBlob = require('rn-fetch-blob');
7878
RNFetchBlob.fs.exists
7979
.mockReturnValue(true);
8080

@@ -191,7 +191,7 @@ describe('lib/FileSystem', function() {
191191

192192
it('#getLocalFilePathFromUrl should return local filepath if it exists on local fs in permanent dir.', () => {
193193

194-
const RNFetchBlob = require('react-native-fetch-blob');
194+
const RNFetchBlob = require('rn-fetch-blob');
195195
RNFetchBlob.fs.exists
196196
.mockReturnValueOnce(true) // mock exist in local permanent dir
197197
.mockReturnValue(true);
@@ -207,7 +207,7 @@ describe('lib/FileSystem', function() {
207207

208208
it('#getLocalFilePathFromUrl should return local filepath if it exists on local fs in cache dir.', () => {
209209

210-
const RNFetchBlob = require('react-native-fetch-blob');
210+
const RNFetchBlob = require('rn-fetch-blob');
211211
RNFetchBlob.fs.exists
212212
.mockReturnValueOnce(false) // mock not exist in local permanent dir
213213
.mockReturnValueOnce(true) // mock exist in local cache dir
@@ -224,7 +224,7 @@ describe('lib/FileSystem', function() {
224224

225225
it('#getLocalFilePathFromUrl should download file and write to disk (default to cache dir) if it does not exist on local fs.', () => {
226226

227-
const RNFetchBlob = require('react-native-fetch-blob');
227+
const RNFetchBlob = require('rn-fetch-blob');
228228
RNFetchBlob.fs.exists
229229
.mockReturnValueOnce(false) // mock not exist in local permanent dir
230230
.mockReturnValueOnce(false) // mock not exist in local cache dir
@@ -268,7 +268,7 @@ describe('lib/FileSystem', function() {
268268

269269
const fileSystem = FileSystemFactory();
270270

271-
const RNFetchBlob = require('react-native-fetch-blob');
271+
const RNFetchBlob = require('rn-fetch-blob');
272272
RNFetchBlob.fetch
273273
.mockReturnValue({
274274
path: () => {
@@ -291,7 +291,7 @@ describe('lib/FileSystem', function() {
291291

292292
const fileSystem = FileSystemFactory();
293293

294-
const RNFetchBlob = require('react-native-fetch-blob');
294+
const RNFetchBlob = require('rn-fetch-blob');
295295
RNFetchBlob.fetch
296296
.mockReturnValue({
297297
path: () => {
@@ -318,7 +318,7 @@ describe('lib/FileSystem', function() {
318318

319319
const fileSystem = FileSystemFactory();
320320

321-
const RNFetchBlob = require('react-native-fetch-blob');
321+
const RNFetchBlob = require('rn-fetch-blob');
322322
RNFetchBlob.fetch
323323
.mockReturnValue({
324324
path: () => {
@@ -345,7 +345,7 @@ describe('lib/FileSystem', function() {
345345

346346
const fileSystem = FileSystemFactory();
347347

348-
const RNFetchBlob = require('react-native-fetch-blob');
348+
const RNFetchBlob = require('rn-fetch-blob');
349349
RNFetchBlob.fetch
350350
.mockReturnValue({
351351
path: () => {
@@ -398,7 +398,7 @@ describe('lib/FileSystem', function() {
398398
it('#unlink should work as expected for valid paths.', () => {
399399

400400
// RNFetchBlob Mocks
401-
const RNFetchBlob = require('react-native-fetch-blob');
401+
const RNFetchBlob = require('rn-fetch-blob');
402402

403403
// Mock unlink to be true.
404404
RNFetchBlob.fs.unlink

tests/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jest.mock('react-native', () => {
1919

2020
});
2121

22-
jest.mock('react-native-fetch-blob', () => {
22+
jest.mock('rn-fetch-blob', () => {
2323

2424
const { mockData } = require('./mockData');
2525

tests/imageCacheHoc.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('CacheableImage', function() {
2525
it('renders correctly', () => {
2626

2727
//Mock values for local/remote file request logic.
28-
const RNFetchBlob = require('react-native-fetch-blob');
28+
const RNFetchBlob = require('rn-fetch-blob');
2929
RNFetchBlob.fs.exists
3030
.mockReturnValueOnce(false) // mock not exist in local permanent dir
3131
.mockReturnValueOnce(false) // mock not exist in local cache dir
@@ -77,7 +77,7 @@ describe('CacheableImage', function() {
7777
it('renders correctly with placeholder prop set', () => {
7878

7979
//Mock values for local/remote file request logic.
80-
const RNFetchBlob = require('react-native-fetch-blob');
80+
const RNFetchBlob = require('rn-fetch-blob');
8181
RNFetchBlob.fs.exists
8282
.mockReturnValueOnce(false) // mock not exist in local permanent dir
8383
.mockReturnValueOnce(false) // mock not exist in local cache dir
@@ -141,7 +141,7 @@ describe('CacheableImage', function() {
141141
it('renders correctly with placeholder option set', () => {
142142

143143
//Mock values for local/remote file request logic.
144-
const RNFetchBlob = require('react-native-fetch-blob');
144+
const RNFetchBlob = require('rn-fetch-blob');
145145
RNFetchBlob.fs.exists
146146
.mockReturnValueOnce(false) // mock not exist in local permanent dir
147147
.mockReturnValueOnce(false) // mock not exist in local cache dir

yarn.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3749,13 +3749,6 @@ react-devtools-core@^2.5.0:
37493749
shell-quote "^1.6.1"
37503750
ws "^2.0.3"
37513751

3752-
3753-
version "0.10.8"
3754-
resolved "https://registry.yarnpkg.com/react-native-fetch-blob/-/react-native-fetch-blob-0.10.8.tgz#4fc256abae0cb5f10e7c41f28c11b3ff330d72a9"
3755-
dependencies:
3756-
base-64 "0.1.0"
3757-
glob "7.0.6"
3758-
37593752
react-native-uuid@^1.4.9:
37603753
version "1.4.9"
37613754
resolved "https://registry.yarnpkg.com/react-native-uuid/-/react-native-uuid-1.4.9.tgz#a526742f8fddfe6414500655212ca8d109c40229"
@@ -4081,6 +4074,13 @@ rimraf@~2.2.6:
40814074
version "2.2.8"
40824075
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582"
40834076

4077+
4078+
version "0.10.13"
4079+
resolved "https://registry.yarnpkg.com/rn-fetch-blob/-/rn-fetch-blob-0.10.13.tgz#e0fd5eac1a3a872563b35061353d96c4e51ae1cc"
4080+
dependencies:
4081+
base-64 "0.1.0"
4082+
glob "7.0.6"
4083+
40844084
40854085
version "1.2.0"
40864086
resolved "https://registry.yarnpkg.com/rndm/-/rndm-1.2.0.tgz#f33fe9cfb52bbfd520aa18323bc65db110a1b76c"

0 commit comments

Comments
 (0)