Skip to content
Merged
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,3 @@ Gemfile.lock
!.yarn/sdks
!.yarn/versions

/ios/ReactNativeVersionExtracted.h
4 changes: 1 addition & 3 deletions ReactNativeNavigation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use_hermes_flag = use_hermes ? "-DUSE_HERMES=1" : ""

Pod::Spec.new do |s|
s.name = "ReactNativeNavigation"
s.prepare_command = 'node autolink/postlink/__helpers__/generate_version_header.js'
s.version = package['version']
s.summary = package['description']

Expand All @@ -24,8 +23,7 @@ Pod::Spec.new do |s|
s.exclude_files = "ios/ReactNativeNavigationTests/**/*.*", "ios/OCMock/**/*.*"

s.public_header_files = [
'ios/RNNAppDelegate.h',
'ios/ReactNativeVersionExtracted.h'
'ios/RNNAppDelegate.h'
]

# Add Folly compiler flags to prevent coroutines header issues
Expand Down
20 changes: 17 additions & 3 deletions ios/RNNAppDelegate.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
#import <Foundation/Foundation.h>
#import <React/CoreModulesPlugins.h>
#import <ReactNativeNavigation/ReactNativeVersionExtracted.h>

#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
// Detect RN 0.79+ by checking for RCTJSRuntimeConfiguratorProtocol.h (added in 0.79)
#if __has_include(<React-RCTAppDelegate/RCTJSRuntimeConfiguratorProtocol.h>) || \
__has_include(<React_RCTAppDelegate/RCTJSRuntimeConfiguratorProtocol.h>)
#define RNN_RN_VERSION_79_OR_NEWER 1
#else
#define RNN_RN_VERSION_79_OR_NEWER 0
// Detect RN 0.78 by checking for RCTReactNativeFactory.h (added in 0.78, doesn't exist in 0.77)
#if __has_include(<React-RCTAppDelegate/RCTReactNativeFactory.h>) || \
__has_include(<React_RCTAppDelegate/RCTReactNativeFactory.h>)
#define RNN_RN_VERSION_78 1
#else
#define RNN_RN_VERSION_78 0
#endif
#endif

#if !RNN_RN_VERSION_79_OR_NEWER
#if __has_include(<React-RCTAppDelegate/RCTAppDelegate.h>)
#import <React-RCTAppDelegate/RCTAppDelegate.h>
#elif __has_include(<React_RCTAppDelegate/RCTAppDelegate.h>)
Expand Down Expand Up @@ -30,7 +44,7 @@

#import <React/RCTBundleURLProvider.h>

#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
#if !RNN_RN_VERSION_79_OR_NEWER
@interface RNNAppDelegate : RCTAppDelegate
#else
@interface RNNAppDelegate : UIResponder <UIApplicationDelegate>
Expand Down
22 changes: 11 additions & 11 deletions ios/RNNAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@

static NSString *const kRNConcurrentRoot = @"concurrentRoot";

#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
@interface RNNAppDelegate () <RCTTurboModuleManagerDelegate,
RCTComponentViewFactoryComponentProvider> {
}
@end
#if !RNN_RN_VERSION_79_OR_NEWER
@interface RNNAppDelegate () <RCTTurboModuleManagerDelegate,
RCTComponentViewFactoryComponentProvider> {
}
@end
#else
@interface RNNAppDelegate () {
}
@end
@interface RNNAppDelegate () {
}
@end
#endif

@implementation RNNAppDelegate

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
#if !RNN_RN_VERSION_79_OR_NEWER
[self _setUpFeatureFlags];
#if RN_VERSION_MINOR == 77
#if !RNN_RN_VERSION_78
self.rootViewFactory = [self createRCTRootViewFactory];
#else
self.reactNativeFactory = [[RCTReactNativeFactory alloc] init];
Expand Down Expand Up @@ -82,7 +82,7 @@ - (BOOL)application:(UIApplication *)application
}


#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
#if !RNN_RN_VERSION_79_OR_NEWER
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
[NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"
format:@"Subclasses must implement a valid sourceURLForBridge method"];
Expand Down
8 changes: 4 additions & 4 deletions playground/ios/playground/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#import "RNNCustomViewController.h"
#import <ReactNativeNavigation/ReactNativeNavigation.h>

#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
#if !RNN_RN_VERSION_79_OR_NEWER
@interface AppDelegate () <RCTBridgeDelegate>
@end
#else
Expand Down Expand Up @@ -35,14 +35,14 @@ @implementation AppDelegate

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
#if (RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR >= 79) || RN_VERSION_MAJOR > 0
#if RNN_RN_VERSION_79_OR_NEWER
self.reactNativeDelegate = [ReactNativeDelegate new];
#endif

[super application:application didFinishLaunchingWithOptions:launchOptions];


#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
#if !RNN_RN_VERSION_79_OR_NEWER
self.dependencyProvider = [RCTAppDependencyProvider new];
#endif

Expand All @@ -55,7 +55,7 @@ - (BOOL)application:(UIApplication *)application
return YES;
}

#if RN_VERSION_MAJOR == 0 && RN_VERSION_MINOR < 79
#if !RNN_RN_VERSION_79_OR_NEWER
#pragma mark - RCTBridgeDelegate
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
Expand Down