ソースを参照

Merge pull request #85 from alextkd/master

add support for newer react-native versions and backwards compatibility for previous
Yonah Forst 8 年 前
コミット
0af1a22c06
3 ファイル変更27 行追加6 行削除
  1. 5 1
      RCTConvert+RNPStatus.h
  2. 5 2
      ReactNativePermissions.h
  3. 17 3
      ReactNativePermissions.m

+ 5 - 1
RCTConvert+RNPStatus.h

@@ -6,7 +6,11 @@
 //  Copyright © 2016 Yonah Forst. All rights reserved.
 //
 
-#import <React/RCTConvert.h>
+#if __has_include("RCTConvert.h")
+  #import "RCTConvert.h"
+#else
+  #import <React/RCTConvert.h>
+#endif
 
 static NSString* RNPStatusUndetermined = @"undetermined";
 static NSString* RNPStatusDenied = @"denied";

+ 5 - 2
ReactNativePermissions.h

@@ -5,9 +5,12 @@
 //  Created by Yonah Forst on 18/02/16.
 //  Copyright © 2016 Yonah Forst. All rights reserved.
 //
-#import <React/RCTBridgeModule.h>
 
-#import <Foundation/Foundation.h>
+#if __has_include("RCTBridgeModule.h")
+  #import "RCTBridgeModule.h"
+#else
+  #import <React/RCTBridgeModule.h>
+#endif
 
 @interface ReactNativePermissions : NSObject <RCTBridgeModule>
 

+ 17 - 3
ReactNativePermissions.m

@@ -10,9 +10,23 @@
 
 #import "ReactNativePermissions.h"
 
-#import <React/RCTBridge.h>
-#import <React/RCTConvert.h>
-#import <React/RCTEventDispatcher.h>
+#if __has_include("RCTBridge.h")
+  #import "RCTBridge.h"
+#else
+  #import <React/RCTBridge.h>
+#endif
+
+#if __has_include("RCTConvert.h")
+  #import "RCTConvert.h"
+#else
+  #import <React/RCTConvert.h>
+#endif
+
+#if __has_include("RCTEventDispatcher.h")
+  #import "RCTEventDispatcher.h"
+#else
+  #import <React/RCTEventDispatcher.h>
+#endif
 
 #import "RNPLocation.h"
 #import "RNPBluetooth.h"