Skip to content
wkh237 edited this page May 25, 2016 · 30 revisions

react-native-fetch-blob development guide

This wiki is for developers who interesting in modify and improving this module.

prerequisites

run and install test app

Before install the test app, you should replace constants DROPBOX_TOKEN and TEST_SERVER_URL in test/tests.js

// replace this with your machine's IP
+ const TEST_SERVER_URL = 'http://192.168.0.14:8123'                                                                                     
// replace this with your dropbox token
+ const DROPBOX_TOKEN = 'fsXcpmKPrHgAAAAAAAAAoXZhcXYWdgLpQMan6Tb_bzJ237DXhgQSev12hA-gUXt4'                                          

I have made a test app for development, simply execute npm test <platform> command in project's root folder.

$ npm test ios
# or
$ npm test android

The script will initialize a new RN app named RNFetchBlobTest (right in the project's /RNFetchBlobTest folder), it will also launch the test app by the platform given, and a nodejs server for test.

work on android native code

After the test app installed, change settings.gradle in RNFetchBlobTest/android/

rootProject.name = 'RNFetchBlobTest'

include ':app'
include ':react-native-fetch-blob'
// change this line so that the fetch-blob module in test app points to android project in src folder
- project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fetch-blob/android')                         
+ project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, '../../src/android')                         

Now open the android project in RNFetchBlobTest/android folder with you IDE, every changes you made to react-native-fetch-blob project will directly maps to src folder.

work on ios native code

After the test app installed, open the .xcodeproj file inside RNFetchBlobTest/ios with XCode.

Delete existed RNFetchBlob.xcodeproj in RNFetchBlobTest -> Libraries since this one is the one in RNFetchBlobTest/node_modules/react-native-fetch-blob/ios/ we're going to change its reference to src/ios/RNFetchBlob.xcodeproj.

Right click on Libraries select add new files to "RNFetchBlobTest.xcodeproj" .. and select src/ios/RNFetchBlob.xcodeproj. Now every changes you made to RNFetchBlob project will directly maps to the one in src folder.

Clone this wiki locally