Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IOS compile error for RN version > 0.40 #216

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ios/RCTWebViewBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import "RCTView.h"
/**
* Fix compile error for RN version > 0.40
*/
#if __has_include(<React/RCTView.h>)
#import <React/RCTView.h>
#elif __has_include("RCTView.h")
#import "RCTView.h"
#else
#import "React/RCTView.h"
#endif

@class RCTWebViewBridge;

Expand Down
42 changes: 30 additions & 12 deletions ios/RCTWebViewBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,36 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import "RCTWebViewBridge.h"

#import <UIKit/UIKit.h>

#import "RCTAutoInsetsProtocol.h"
#import "RCTConvert.h"
#import "RCTEventDispatcher.h"
#import "RCTLog.h"
#import "RCTUtils.h"
#import "RCTView.h"
#import "UIView+React.h"
#import <objc/runtime.h>
#import "RCTWebViewBridge.h"

#import <UIKit/UIKit.h>

#if __has_include(<React/RCTAutoInsetsProtocol.h>)
#import <React/RCTAutoInsetsProtocol.h>
#import <React/RCTConvert.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTLog.h>
#import <React/RCTUtils.h>
#import <React/RCTView.h>
#import <React/UIView+React.h>
#elif __has_include("RCTAutoInsetsProtocol.h")
#import "RCTAutoInsetsProtocol.h"
#import "RCTConvert.h"
#import "RCTEventDispatcher.h"
#import "RCTLog.h"
#import "RCTUtils.h"
#import "RCTView.h"
#import "UIView+React.h"
#else
#import "React/RCTAutoInsetsProtocol.h"
#import "React/RCTConvert.h"
#import "React/RCTEventDispatcher.h"
#import "React/RCTLog.h"
#import "React/RCTUtils.h"
#import "React/RCTView.h"
#import "React/UIView+React.h"
#endif
#import <objc/runtime.h>

//This is a very elegent way of defining multiline string in objective-c.
//source: http://stackoverflow.com/a/23387659/828487
Expand Down
8 changes: 7 additions & 1 deletion ios/RCTWebViewBridgeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import "RCTViewManager.h"
#if __has_include(<React/RCTViewManager.h>)
#import <React/RCTViewManager.h>
#elif __has_include("RCTViewManager.h")
#import "RCTViewManager.h"
#else
#import "React/RCTViewManager.h"
#endif

@interface RCTWebViewBridgeManager : RCTViewManager

Expand Down
22 changes: 16 additions & 6 deletions ios/RCTWebViewBridgeManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import "RCTWebViewBridgeManager.h"

#import "RCTBridge.h"
#import "RCTUIManager.h"
#import "RCTWebViewBridge.h"
#import "UIView+React.h"
#import "RCTWebViewBridge.h"
#import "RCTWebViewBridgeManager.h"

#if __has_include(<React/RCTBridge.h>)
#import <React/RCTBridge.h>
#import <React/RCTUIManager.h>
#import <React/UIView+React.h>
#elif __has_include("RCTBridge.h")
#import "RCTBridge.h"
#import "RCTUIManager.h"
#import "UIView+React.h"
#else
#import "React/RCTBridge.h"
#import "React/RCTUIManager.h"
#import "React/UIView+React.h"
#endif

@interface RCTWebViewBridgeManager () <RCTWebViewBridgeDelegate>

Expand Down