Browse Source

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

Fix prelink for rn 0.40
wkh237 8 years ago
parent
commit
bb20e36115
2 changed files with 5 additions and 4 deletions
  1. 1
    1
      src/ios/RNFetchBlob/RNFetchBlob.h
  2. 4
    3
      src/scripts/prelink.js

+ 1
- 1
src/ios/RNFetchBlob/RNFetchBlob.h View File

5
 //
5
 //
6
 
6
 
7
 //XXX: DO NO REMOVE THIS LINE IF YOU'RE USING IT ON RN > 0.40 PROJECT
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
 #ifndef RNFetchBlob_h
11
 #ifndef RNFetchBlob_h

+ 4
- 3
src/scripts/prelink.js View File

20
     fs.writeFileSync(PACKAGE_GRADLE, main);
20
     fs.writeFileSync(PACKAGE_GRADLE, main);
21
     console.log('adding OkHttp3 dependency to pre 0.28 project .. ok')
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
     glob('**/RNFetchBlob.h',{}, function(err, files) {
26
     glob('**/RNFetchBlob.h',{}, function(err, files) {
26
       if(Array.isArray(files)) {
27
       if(Array.isArray(files)) {
27
         var target = process.cwd() + '/' + files[0];
28
         var target = process.cwd() + '/' + files[0];
28
         console.log('\033[92mPatching .. \033[97m' + target);
29
         console.log('\033[92mPatching .. \033[97m' + target);
29
         var data = fs.readFileSync(target);
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
         console.log('done.')
32
         console.log('done.')
32
       }
33
       }
33
     })
34
     })