react-native-navigation 8.1.0-rc02 → 8.1.0-rc02-snapshot.1739

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,19 @@ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
 
5
5
  fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
6
6
 
7
+ # Detect if this is a Swift project by looking for user AppDelegate.swift files
8
+ dependency_paths = ['/node_modules/', '/Pods/', '/build/', '/Build/', '/DerivedData/']
9
+ swift_project = Dir.glob('**/AppDelegate.swift')
10
+ .reject { |file| dependency_paths.any? { |path| file.include?(path) } }
11
+ .any?
12
+
13
+ # Debug output
14
+ if swift_project
15
+ puts "ReactNativeNavigation: Swift AppDelegate detected - enabling Swift-compatible configuration"
16
+ else
17
+ puts "ReactNativeNavigation: Objective-C AppDelegate detected - using standard configuration"
18
+ end
19
+
7
20
  Pod::Spec.new do |s|
8
21
  s.name = "ReactNativeNavigation"
9
22
  s.version = package['version']
@@ -21,14 +34,29 @@ Pod::Spec.new do |s|
21
34
  s.source = { :git => "https://github.com/wix/react-native-navigation.git", :tag => "#{s.version}" }
22
35
  s.source_files = 'lib/ios/**/*.{h,m,mm,cpp}'
23
36
  s.exclude_files = "lib/ios/ReactNativeNavigationTests/**/*.*", "lib/ios/OCMock/**/*.*"
37
+ # Only expose headers for Swift projects
38
+ if swift_project
39
+ s.public_header_files = [
40
+ 'lib/ios/RNNAppDelegate.h'
41
+ ]
42
+ end
24
43
  end
25
44
 
26
45
  folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -DFOLLY_CFG_NO_COROUTINES=1'
27
- s.pod_target_xcconfig = {
46
+
47
+ # Base xcconfig settings
48
+ xcconfig_settings = {
28
49
  'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly" "$(PODS_ROOT)/Headers/Private/React-Core" "$(PODS_ROOT)/Headers/Private/Yoga"',
29
50
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
30
51
  "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
31
52
  }
53
+
54
+ # Only add DEFINES_MODULE for Swift projects
55
+ if swift_project
56
+ xcconfig_settings["DEFINES_MODULE"] = "YES"
57
+ end
58
+
59
+ s.pod_target_xcconfig = xcconfig_settings
32
60
 
33
61
  if fabric_enabled
34
62
  install_modules_dependencies(s)
@@ -33,4 +33,4 @@
33
33
  return true;
34
34
  }
35
35
 
36
- @end
36
+ @end
@@ -0,0 +1,30 @@
1
+ import UIKit
2
+ import React
3
+ import React_RCTAppDelegate
4
+ import ReactAppDependencyProvider
5
+
6
+ @main
7
+ class AppDelegate: RCTAppDelegate {
8
+ override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
9
+ self.moduleName = "app"
10
+ self.dependencyProvider = RCTAppDependencyProvider()
11
+
12
+ // You can add your custom initial props in the dictionary below.
13
+ // They will be passed down to the ViewController used by React Native.
14
+ self.initialProps = [:]
15
+
16
+ return super.application(application, didFinishLaunchingWithOptions: launchOptions)
17
+ }
18
+
19
+ override func sourceURL(for bridge: RCTBridge) -> URL? {
20
+ self.bundleURL()
21
+ }
22
+
23
+ override func bundleURL() -> URL? {
24
+ #if DEBUG
25
+ RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
26
+ #else
27
+ Bundle.main.url(forResource: "main", withExtension: "jsbundle")
28
+ #endif
29
+ }
30
+ }
@@ -1,55 +1,17 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`appDelegateLinker should work for RN 0.68 1`] = `
3
+ exports[`appDelegateLinker should work for RN 0.77 with Objective-C 1`] = `
4
4
  "#import "AppDelegate.h"
5
5
  #import <ReactNativeNavigation/ReactNativeNavigation.h>
6
6
 
7
- #import <React/RCTBridge.h>
8
7
  #import <React/RCTBundleURLProvider.h>
9
8
 
10
- #import <React/RCTAppSetupUtils.h>
11
-
12
- #if RCT_NEW_ARCH_ENABLED
13
- #import <React/CoreModulesPlugins.h>
14
- #import <React/RCTCxxBridgeDelegate.h>
15
- #import <React/RCTFabricSurfaceHostingProxyRootView.h>
16
- #import <React/RCTSurfacePresenter.h>
17
- #import <React/RCTSurfacePresenterBridgeAdapter.h>
18
- #import <ReactCommon/RCTTurboModuleManager.h>
19
-
20
- #import <react/config/ReactNativeConfig.h>
21
-
22
- @interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
23
- RCTTurboModuleManager *_turboModuleManager;
24
- RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
25
- std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
26
- facebook::react::ContextContainer::Shared _contextContainer;
27
- }
28
- @end
29
- #endif
30
-
31
9
  @implementation AppDelegate
32
10
 
33
11
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
34
12
  {
35
- RCTAppSetupPrepareApp(application);
36
-
37
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
38
- [ReactNativeNavigation bootstrapWithBridge:bridge];
39
-
40
- #if RCT_NEW_ARCH_ENABLED
41
- _contextContainer = std::make_shared<facebook::react::ContextContainer const>();
42
- _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
43
- _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
44
- _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
45
- bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
46
- #endif
47
-
48
-
49
-
50
13
 
51
-
52
- return YES;
14
+ return [super application:application didFinishLaunchingWithOptions:launchOptions];
53
15
  }
54
16
 
55
17
  - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
@@ -61,210 +23,48 @@ exports[`appDelegateLinker should work for RN 0.68 1`] = `
61
23
  #endif
62
24
  }
63
25
 
64
- #if RCT_NEW_ARCH_ENABLED
65
-
66
- #pragma mark - RCTCxxBridgeDelegate
67
-
68
- - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
69
- {
70
- _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
71
- delegate:self
72
- jsInvoker:bridge.jsCallInvoker];
73
- return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
74
- }
75
-
76
- #pragma mark RCTTurboModuleManagerDelegate
77
-
78
- - (Class)getModuleClassFromName:(const char *)name
79
- {
80
- return RCTCoreModulesClassProvider(name);
81
- }
82
-
83
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
84
- jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
85
- {
86
- return nullptr;
87
- }
88
-
89
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
90
- initParams:
91
- (const facebook::react::ObjCTurboModule::InitParams &)params
92
- {
93
- return nullptr;
94
- }
95
-
96
- - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
97
- {
98
- return RCTAppSetupDefaultModuleFromClass(moduleClass);
99
- }
100
-
101
- #endif
102
-
103
- @end
104
- "
105
- `;
106
-
107
- exports[`appDelegateLinker should work for RN 0.69 1`] = `
108
- "#import "AppDelegate.h"
109
- #import <ReactNativeNavigation/ReactNativeNavigation.h>
110
-
111
- #import <React/RCTBridge.h>
112
- #import <React/RCTBundleURLProvider.h>
113
-
114
- #import <React/RCTAppSetupUtils.h>
115
-
116
- #if RCT_NEW_ARCH_ENABLED
117
- #import <React/CoreModulesPlugins.h>
118
- #import <React/RCTCxxBridgeDelegate.h>
119
- #import <React/RCTFabricSurfaceHostingProxyRootView.h>
120
- #import <React/RCTSurfacePresenter.h>
121
- #import <React/RCTSurfacePresenterBridgeAdapter.h>
122
- #import <ReactCommon/RCTTurboModuleManager.h>
123
-
124
- #import <react/config/ReactNativeConfig.h>
125
-
126
- static NSString *const kRNConcurrentRoot = @"concurrentRoot";
127
-
128
- @interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
129
- RCTTurboModuleManager *_turboModuleManager;
130
- RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
131
- std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
132
- facebook::react::ContextContainer::Shared _contextContainer;
133
- }
134
- @end
135
- #endif
136
-
137
- @implementation AppDelegate
138
-
139
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
140
- {
141
- RCTAppSetupPrepareApp(application);
142
-
143
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
144
- [ReactNativeNavigation bootstrapWithBridge:bridge];
145
-
146
- #if RCT_NEW_ARCH_ENABLED
147
- _contextContainer = std::make_shared<facebook::react::ContextContainer const>();
148
- _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
149
- _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
150
- _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
151
- bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
152
- #endif
153
-
154
-
155
-
156
-
157
-
158
- return YES;
159
- }
160
-
161
26
  /// This method controls whether the \`concurrentRoot\`feature of React18 is turned on or off.
162
27
  ///
163
28
  /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
164
29
  /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
165
- /// @return: \`true\` if the \`concurrentRoot\` feture is enabled. Otherwise, it returns \`false\`.
30
+ /// @return: \`true\` if the \`concurrentRoot\` feature is enabled. Otherwise, it returns \`false\`.
166
31
  - (BOOL)concurrentRootEnabled
167
32
  {
168
- // Switch this bool to turn on and off the concurrent root
169
33
  return true;
170
34
  }
171
35
 
172
- - (NSDictionary *)prepareInitialProps
173
- {
174
- NSMutableDictionary *initProps = [NSMutableDictionary new];
175
-
176
- #ifdef RCT_NEW_ARCH_ENABLED
177
- initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
178
- #endif
179
-
180
- return initProps;
181
- }
182
-
183
- - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
184
- {
185
- #if DEBUG
186
- return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
187
- #else
188
- return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
189
- #endif
190
- }
191
-
192
- #if RCT_NEW_ARCH_ENABLED
193
-
194
- #pragma mark - RCTCxxBridgeDelegate
195
-
196
- - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
197
- {
198
- _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
199
- delegate:self
200
- jsInvoker:bridge.jsCallInvoker];
201
- return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
202
- }
203
-
204
- #pragma mark RCTTurboModuleManagerDelegate
205
-
206
- - (Class)getModuleClassFromName:(const char *)name
207
- {
208
- return RCTCoreModulesClassProvider(name);
209
- }
210
-
211
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
212
- jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
213
- {
214
- return nullptr;
215
- }
216
-
217
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
218
- initParams:
219
- (const facebook::react::ObjCTurboModule::InitParams &)params
220
- {
221
- return nullptr;
222
- }
223
-
224
- - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
225
- {
226
- return RCTAppSetupDefaultModuleFromClass(moduleClass);
227
- }
228
-
229
- #endif
230
-
231
- @end
232
- "
36
+ @end "
233
37
  `;
234
38
 
235
- exports[`appDelegateLinker should work for RN 0.71 1`] = `
236
- "#import "AppDelegate.h"
237
- #import <ReactNativeNavigation/ReactNativeNavigation.h>
39
+ exports[`appDelegateLinker should work for RN 0.77 with Swift 1`] = `
40
+ "import UIKit
41
+ import React
42
+ import ReactNativeNavigation
43
+ import ReactAppDependencyProvider
238
44
 
239
- #import <React/RCTBundleURLProvider.h>
45
+ @main
46
+ class AppDelegate: RNNAppDelegate {
47
+ override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
48
+ self.moduleName = "app"
49
+ self.dependencyProvider = RCTAppDependencyProvider()
240
50
 
241
- @implementation AppDelegate
51
+ // You can add your custom initial props in the dictionary below.
52
+ // They will be passed down to the ViewController used by React Native.
53
+ self.initialProps = [:]
242
54
 
243
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
244
- {
245
-
246
- return [super application:application didFinishLaunchingWithOptions:launchOptions];
247
- }
55
+ return super.application(application, didFinishLaunchingWithOptions: launchOptions)
56
+ }
248
57
 
249
- - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
250
- {
58
+ override func sourceURL(for bridge: RCTBridge) -> URL? {
59
+ self.bundleURL()
60
+ }
61
+
62
+ override func bundleURL() -> URL? {
251
63
  #if DEBUG
252
- return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
64
+ RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
253
65
  #else
254
- return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
66
+ Bundle.main.url(forResource: "main", withExtension: "jsbundle")
255
67
  #endif
256
- }
257
-
258
- /// This method controls whether the \`concurrentRoot\`feature of React18 is turned on or off.
259
- ///
260
- /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
261
- /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
262
- /// @return: \`true\` if the \`concurrentRoot\` feature is enabled. Otherwise, it returns \`false\`.
263
- - (BOOL)concurrentRootEnabled
264
- {
265
- return true;
266
- }
267
-
268
- @end
269
- "
68
+ }
69
+ } "
270
70
  `;
@@ -1,6 +1,7 @@
1
1
  // @ts-check
2
2
  var fs = require('fs');
3
3
  var path = require('./path');
4
+ var nodePath = require('path');
4
5
  var { warnn, logn, infon, debugn, errorn } = require('./log');
5
6
 
6
7
  class AppDelegateLinker {
@@ -21,34 +22,46 @@ class AppDelegateLinker {
21
22
 
22
23
  logn('Linking AppDelegate...');
23
24
 
24
- var appDelegateContents = fs.readFileSync(this.appDelegatePath, 'utf8');
25
+ // New flow for Swift
26
+ if (nodePath.extname(this.appDelegatePath) === '.swift') {
27
+ debugn('Entering Swift flow ...');
28
+ var appDelegateContents = fs.readFileSync(this.appDelegatePath, 'utf8');
29
+ appDelegateContents = this._extendRNNAppDelegateSwift(appDelegateContents);
30
+ fs.writeFileSync(this.appDelegatePath, appDelegateContents);
31
+ this.removeUnneededImportsSuccess = true
32
+ this.removeApplicationLaunchContentSuccess = true
33
+
34
+ } else { // Old flow for Objective-C
35
+ debugn('Entering Objective-C flow ...');
36
+ var appDelegateContents = fs.readFileSync(this.appDelegatePath, 'utf8');
37
+
38
+ if (this.appDelegateHeaderPath) {
39
+ var appDelegateHeaderContents = fs.readFileSync(this.appDelegateHeaderPath, 'utf8');
40
+ appDelegateHeaderContents = this._extendRNNAppDelegate(appDelegateHeaderContents);
41
+ fs.writeFileSync(this.appDelegateHeaderPath, appDelegateHeaderContents);
42
+ }
25
43
 
26
- if (this.appDelegateHeaderPath) {
27
- var appDelegateHeaderContents = fs.readFileSync(this.appDelegateHeaderPath, 'utf8');
28
- appDelegateHeaderContents = this._extendRNNAppDelegate(appDelegateHeaderContents);
29
- fs.writeFileSync(this.appDelegateHeaderPath, appDelegateHeaderContents);
30
- }
44
+ try {
45
+ appDelegateContents = this._removeUnneededImports(appDelegateContents);
46
+ this.removeUnneededImportsSuccess = true;
47
+ } catch (e) {
48
+ errorn(' ' + e.message);
49
+ }
31
50
 
32
- try {
33
- appDelegateContents = this._removeUnneededImports(appDelegateContents);
34
- this.removeUnneededImportsSuccess = true;
35
- } catch (e) {
36
- errorn(' ' + e.message);
37
- }
51
+ appDelegateContents = this._importNavigation(appDelegateContents);
38
52
 
39
- appDelegateContents = this._importNavigation(appDelegateContents);
53
+ appDelegateContents = this._bootstrapNavigation(appDelegateContents);
40
54
 
41
- appDelegateContents = this._bootstrapNavigation(appDelegateContents);
55
+ try {
56
+ appDelegateContents = this._removeApplicationLaunchContent(appDelegateContents);
57
+ this.removeApplicationLaunchContentSuccess = true;
58
+ } catch (e) {
59
+ errorn(' ' + e.message);
60
+ }
42
61
 
43
- try {
44
- appDelegateContents = this._removeApplicationLaunchContent(appDelegateContents);
45
- this.removeApplicationLaunchContentSuccess = true;
46
- } catch (e) {
47
- errorn(' ' + e.message);
62
+ fs.writeFileSync(this.appDelegatePath, appDelegateContents);
48
63
  }
49
64
 
50
- fs.writeFileSync(this.appDelegatePath, appDelegateContents);
51
-
52
65
  if (this.removeUnneededImportsSuccess && this.removeApplicationLaunchContentSuccess) {
53
66
  infon('AppDelegate linked successfully!\n');
54
67
  } else {
@@ -178,6 +191,19 @@ class AppDelegateLinker {
178
191
  _doesImportNavigation(content) {
179
192
  return /#import\s+\<ReactNativeNavigation\/ReactNativeNavigation.h>/.test(content);
180
193
  }
194
+
195
+ // SWIFT implementation
196
+ _extendRNNAppDelegateSwift(content) {
197
+ return content
198
+ .replace(
199
+ /import React_RCTAppDelegate/,
200
+ 'import ReactNativeNavigation'
201
+ )
202
+ .replace(
203
+ /class AppDelegate: RCTAppDelegate/,
204
+ 'class AppDelegate: RNNAppDelegate'
205
+ )
206
+ }
181
207
  }
182
208
 
183
209
  module.exports = AppDelegateLinker;
@@ -2,6 +2,7 @@ var glob = require('glob');
2
2
  var ignoreFolders = {
3
3
  ignore: ['node_modules/**', '**/build/**', '**/Build/**', '**/DerivedData/**', '**/*-tvOS*/**'],
4
4
  };
5
+ var { warnn, infon, debugn } = require('./log');
5
6
 
6
7
  exports.mainActivityJava = glob.sync('**/MainActivity.java', ignoreFolders)[0];
7
8
  exports.mainActivityKotlin = glob.sync('**/MainActivity.kt', ignoreFolders)[0];
@@ -10,10 +11,28 @@ exports.mainApplicationJava = mainApplicationJava;
10
11
  exports.rootGradle = mainApplicationJava.replace(/android\/app\/.*\.java/, 'android/build.gradle');
11
12
 
12
13
  var reactNativeVersion = require('../../../react-native/package.json').version;
14
+
15
+ infon('Locating the AppDelegate.mm file ...');
13
16
  exports.appDelegate = glob.sync(
14
- reactNativeVersion < '0.68.0' ? '**/AppDelegate.m' : '**/AppDelegate.mm',
17
+ '**/AppDelegate.mm',
15
18
  ignoreFolders
16
19
  )[0];
17
- exports.appDelegateHeader = glob.sync('**/AppDelegate.h', ignoreFolders)[0];
20
+
21
+ if (exports.appDelegate === undefined) {
22
+ warnn('AppDelegate.mm file not found, looking for AppDelegate.swift ...');
23
+ exports.appDelegate = glob.sync(
24
+ '**/AppDelegate.swift',
25
+ ignoreFolders
26
+ )[0];
27
+
28
+ if (exports.appDelegate !== undefined) {
29
+ debugn('Found AppDelegate.swift');
30
+ }
31
+
32
+ } else {
33
+ debugn('Found AppDelegate.mm');
34
+ exports.appDelegateHeader = glob.sync('**/AppDelegate.h', ignoreFolders)[0];
35
+ }
36
+
18
37
  exports.podFile = glob.sync('**/Podfile', ignoreFolders)[0];
19
38
  exports.plist = glob.sync('**/info.plist', ignoreFolders)[0];
@@ -109,7 +109,7 @@ dependencies {
109
109
  testImplementation 'org.assertj:assertj-core:3.11.1'
110
110
  testImplementation 'org.mockito:mockito-core:4.0.0'
111
111
  testImplementation 'com.squareup.assertj:assertj-android:1.2.0'
112
- testImplementation 'org.mockito:mockito-inline:3.4.0'
112
+ testImplementation 'org.mockito:mockito-inline:4.6.1'
113
113
  testImplementation "org.mockito.kotlin:mockito-kotlin:4.0.0"
114
114
  testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
115
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-navigation",
3
- "version": "8.1.0-rc02",
3
+ "version": "8.1.0-rc02-snapshot.1739",
4
4
  "description": "React Native Navigation - truly native navigation for iOS and Android",
5
5
  "license": "MIT",
6
6
  "nativePackage": true,
@@ -1,108 +0,0 @@
1
- #import "AppDelegate.h"
2
-
3
- #import <React/RCTBridge.h>
4
- #import <React/RCTBundleURLProvider.h>
5
- #import <React/RCTRootView.h>
6
-
7
- #import <React/RCTAppSetupUtils.h>
8
-
9
- #if RCT_NEW_ARCH_ENABLED
10
- #import <React/CoreModulesPlugins.h>
11
- #import <React/RCTCxxBridgeDelegate.h>
12
- #import <React/RCTFabricSurfaceHostingProxyRootView.h>
13
- #import <React/RCTSurfacePresenter.h>
14
- #import <React/RCTSurfacePresenterBridgeAdapter.h>
15
- #import <ReactCommon/RCTTurboModuleManager.h>
16
-
17
- #import <react/config/ReactNativeConfig.h>
18
-
19
- @interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
20
- RCTTurboModuleManager *_turboModuleManager;
21
- RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
22
- std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
23
- facebook::react::ContextContainer::Shared _contextContainer;
24
- }
25
- @end
26
- #endif
27
-
28
- @implementation AppDelegate
29
-
30
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
31
- {
32
- RCTAppSetupPrepareApp(application);
33
-
34
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
35
-
36
- #if RCT_NEW_ARCH_ENABLED
37
- _contextContainer = std::make_shared<facebook::react::ContextContainer const>();
38
- _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
39
- _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
40
- _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
41
- bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
42
- #endif
43
-
44
- UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"app", nil);
45
-
46
- if (@available(iOS 13.0, *)) {
47
- rootView.backgroundColor = [UIColor systemBackgroundColor];
48
- } else {
49
- rootView.backgroundColor = [UIColor whiteColor];
50
- }
51
-
52
- self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
53
- UIViewController *rootViewController = [UIViewController new];
54
- rootViewController.view = rootView;
55
- self.window.rootViewController = rootViewController;
56
- [self.window makeKeyAndVisible];
57
- return YES;
58
- }
59
-
60
- - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
61
- {
62
- #if DEBUG
63
- return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
64
- #else
65
- return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
66
- #endif
67
- }
68
-
69
- #if RCT_NEW_ARCH_ENABLED
70
-
71
- #pragma mark - RCTCxxBridgeDelegate
72
-
73
- - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
74
- {
75
- _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
76
- delegate:self
77
- jsInvoker:bridge.jsCallInvoker];
78
- return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
79
- }
80
-
81
- #pragma mark RCTTurboModuleManagerDelegate
82
-
83
- - (Class)getModuleClassFromName:(const char *)name
84
- {
85
- return RCTCoreModulesClassProvider(name);
86
- }
87
-
88
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
89
- jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
90
- {
91
- return nullptr;
92
- }
93
-
94
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
95
- initParams:
96
- (const facebook::react::ObjCTurboModule::InitParams &)params
97
- {
98
- return nullptr;
99
- }
100
-
101
- - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
102
- {
103
- return RCTAppSetupDefaultModuleFromClass(moduleClass);
104
- }
105
-
106
- #endif
107
-
108
- @end
@@ -1,133 +0,0 @@
1
- #import "AppDelegate.h"
2
-
3
- #import <React/RCTBridge.h>
4
- #import <React/RCTBundleURLProvider.h>
5
- #import <React/RCTRootView.h>
6
-
7
- #import <React/RCTAppSetupUtils.h>
8
-
9
- #if RCT_NEW_ARCH_ENABLED
10
- #import <React/CoreModulesPlugins.h>
11
- #import <React/RCTCxxBridgeDelegate.h>
12
- #import <React/RCTFabricSurfaceHostingProxyRootView.h>
13
- #import <React/RCTSurfacePresenter.h>
14
- #import <React/RCTSurfacePresenterBridgeAdapter.h>
15
- #import <ReactCommon/RCTTurboModuleManager.h>
16
-
17
- #import <react/config/ReactNativeConfig.h>
18
-
19
- static NSString *const kRNConcurrentRoot = @"concurrentRoot";
20
-
21
- @interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
22
- RCTTurboModuleManager *_turboModuleManager;
23
- RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
24
- std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
25
- facebook::react::ContextContainer::Shared _contextContainer;
26
- }
27
- @end
28
- #endif
29
-
30
- @implementation AppDelegate
31
-
32
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
33
- {
34
- RCTAppSetupPrepareApp(application);
35
-
36
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
37
-
38
- #if RCT_NEW_ARCH_ENABLED
39
- _contextContainer = std::make_shared<facebook::react::ContextContainer const>();
40
- _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
41
- _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
42
- _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
43
- bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
44
- #endif
45
-
46
- NSDictionary *initProps = [self prepareInitialProps];
47
- UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"app", initProps);
48
-
49
- if (@available(iOS 13.0, *)) {
50
- rootView.backgroundColor = [UIColor systemBackgroundColor];
51
- } else {
52
- rootView.backgroundColor = [UIColor whiteColor];
53
- }
54
-
55
- self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
56
- UIViewController *rootViewController = [UIViewController new];
57
- rootViewController.view = rootView;
58
- self.window.rootViewController = rootViewController;
59
- [self.window makeKeyAndVisible];
60
- return YES;
61
- }
62
-
63
- /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
64
- ///
65
- /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
66
- /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
67
- /// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`.
68
- - (BOOL)concurrentRootEnabled
69
- {
70
- // Switch this bool to turn on and off the concurrent root
71
- return true;
72
- }
73
-
74
- - (NSDictionary *)prepareInitialProps
75
- {
76
- NSMutableDictionary *initProps = [NSMutableDictionary new];
77
-
78
- #ifdef RCT_NEW_ARCH_ENABLED
79
- initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
80
- #endif
81
-
82
- return initProps;
83
- }
84
-
85
- - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
86
- {
87
- #if DEBUG
88
- return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
89
- #else
90
- return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
91
- #endif
92
- }
93
-
94
- #if RCT_NEW_ARCH_ENABLED
95
-
96
- #pragma mark - RCTCxxBridgeDelegate
97
-
98
- - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
99
- {
100
- _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
101
- delegate:self
102
- jsInvoker:bridge.jsCallInvoker];
103
- return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
104
- }
105
-
106
- #pragma mark RCTTurboModuleManagerDelegate
107
-
108
- - (Class)getModuleClassFromName:(const char *)name
109
- {
110
- return RCTCoreModulesClassProvider(name);
111
- }
112
-
113
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
114
- jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
115
- {
116
- return nullptr;
117
- }
118
-
119
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
120
- initParams:
121
- (const facebook::react::ObjCTurboModule::InitParams &)params
122
- {
123
- return nullptr;
124
- }
125
-
126
- - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
127
- {
128
- return RCTAppSetupDefaultModuleFromClass(moduleClass);
129
- }
130
-
131
- #endif
132
-
133
- @end