|
1 |
| -# react-native-fetch-blob [](https://www.npmjs.com/package/react-native-fetch-blob) [](https://www.npmjs.com/package/react-native-fetch-blob)  []() [](https://github.com/wkh237/react-native-fetch-blob/milestones) |
| 1 | +# react-native-fetch-blob [](https://www.npmjs.com/package/react-native-fetch-blob) [](https://www.npmjs.com/package/react-native-fetch-blob)  []() |
2 | 2 |
|
3 |
| -A module provides upload, download, and files access API. Supports file stream read/write for process large files. |
| 3 | +A project committed to make file acess and transfer easier and effiecient for React Native developers. |
4 | 4 |
|
5 | 5 | ## [Please check our github for updated document](https://github.com/wkh237/react-native-fetch-blob)
|
6 | 6 |
|
@@ -49,11 +49,19 @@ Link package using [rnpm](https://github.com/rnpm/rnpm)
|
49 | 49 | rnpm link
|
50 | 50 | ```
|
51 | 51 |
|
52 |
| -### For React Native >= 0.29.0 (Android) |
| 52 | +### Manually link the package (Android) |
53 | 53 |
|
54 |
| -> If you're using react-native >= `0.29.0`, the package might not be able to link through `rnpm link`, and you might see an error screen similar to [#51](https://github.com/wkh237/react-native-fetch-blob/issues/51), this is because a [a bug in 0.29.0](https://github.com/facebook/react-native/commit/4dabb575b1b311ba541fae7eabbd49f08b5391b3), someone has already fixed it, but the solution does not work on our project, you may have to manually add the package yourself. |
| 54 | +If rnpm link command failed to link the package automatically, you might try manually link the package. |
55 | 55 |
|
56 |
| -Add this code to `MainApplication.java` |
| 56 | +Open `android/settings.gradle`, and add these lines which will app RNFetchBlob Android project dependency to your app. |
| 57 | + |
| 58 | +```diff |
| 59 | +include ':app' |
| 60 | ++ include ':react-native-fetch-blob' |
| 61 | ++ project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir,' ../node_modules/react-native-fetch-blob/android') |
| 62 | +``` |
| 63 | + |
| 64 | +Add this line to `MainApplication.java`, so that RNFetchBlob package becomes part of react native package. |
57 | 65 |
|
58 | 66 | ```diff
|
59 | 67 | ...
|
@@ -107,9 +115,22 @@ Beginning in Android 6.0 (API level 23), users grant permissions to apps while t
|
107 | 115 |
|
108 | 116 | ## Recipes
|
109 | 117 |
|
| 118 | +ES6 |
| 119 | + |
| 120 | +The module uses ES6 style export statement, simply use `import` to load the module. |
| 121 | + |
110 | 122 | ```js
|
111 | 123 | import RNFetchBlob from 'react-native-fetch-blob'
|
112 | 124 | ```
|
| 125 | + |
| 126 | +ES5 |
| 127 | + |
| 128 | +If you're using ES5 require statement to load the module, please add `default`. See [here](https://github.com/wkh237/react-native-fetch-blob/wiki/Trouble-Shooting#rnfetchblobfetch-is-not-a-function) for more detail. |
| 129 | + |
| 130 | +``` |
| 131 | +var RNFetchBlob = require('react-native-fetch-blob').default |
| 132 | +``` |
| 133 | + |
113 | 134 | #### Download example : Fetch files that needs authorization token
|
114 | 135 |
|
115 | 136 | ```js
|
@@ -597,6 +618,7 @@ RNFetchBlob.config({
|
597 | 618 |
|
598 | 619 | | Version | |
|
599 | 620 | |---|---|
|
| 621 | +| 0.7.2 | Fix cancel request bug | |
600 | 622 | | 0.7.1 | Fix #57 ios module could not compile on ios version <= 9.3 |
|
601 | 623 | | 0.7.0 | Add support of Android upload progress, and remove AsyncHttpClient dependency from Android native implementation. |
|
602 | 624 | | 0.6.4 | Fix rnpm link script. |
|
|
0 commit comments