瀏覽代碼

Merge pull request #235 from mgiachetti/fix/prelink-rn40

Fix prelink for rn 0.40
wkh237 8 年之前
父節點
當前提交
bb20e36115
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. 1
    1
      src/ios/RNFetchBlob/RNFetchBlob.h
  2. 4
    3
      src/scripts/prelink.js

+ 1
- 1
src/ios/RNFetchBlob/RNFetchBlob.h 查看文件

@@ -5,7 +5,7 @@
5 5
 //
6 6
 
7 7
 //XXX: DO NO REMOVE THIS LINE IF YOU'RE USING IT ON RN > 0.40 PROJECT
8
-//#define RN040_IMPORT
8
+#define RN040_IMPORT
9 9
 
10 10
 
11 11
 #ifndef RNFetchBlob_h

+ 4
- 3
src/scripts/prelink.js 查看文件

@@ -20,14 +20,15 @@ try {
20 20
     fs.writeFileSync(PACKAGE_GRADLE, main);
21 21
     console.log('adding OkHttp3 dependency to pre 0.28 project .. ok')
22 22
   }
23
-  else if (VERSION >= 0.40) {
24
-    console.log('Adding RN040_IMPORT for RN >= 0.40 project ..')
23
+
24
+  if (VERSION < 0.40) {
25
+    console.log('Removing RN040_IMPORT for RN < 0.40 project ..')
25 26
     glob('**/RNFetchBlob.h',{}, function(err, files) {
26 27
       if(Array.isArray(files)) {
27 28
         var target = process.cwd() + '/' + files[0];
28 29
         console.log('\033[92mPatching .. \033[97m' + target);
29 30
         var data = fs.readFileSync(target);
30
-        fs.writeFileSync(target, String(data).replace(/\/\/#define RN040_IMPORT/, '#define RN040_IMPORT'));
31
+        fs.writeFileSync(target, String(data).replace(/#define RN040_IMPORT/, ''));
31 32
         console.log('done.')
32 33
       }
33 34
     })