react-native-navigation 7.29.0 → 7.29.1-snapshot.730
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.
- package/ReactNativeNavigation.podspec +7 -7
- package/autolink/fixtures/rn68/AppDelegate.mm.template +108 -0
- package/autolink/fixtures/rn68/MainActivity.java.template +40 -0
- package/autolink/fixtures/rn69/AppDelegate.mm.template +133 -0
- package/autolink/fixtures/rn69/MainActivity.java.template +48 -0
- package/autolink/postlink/__snapshots__/activityLinker.test.js.snap +68 -0
- package/autolink/postlink/__snapshots__/appDelegateLinker.test.js.snap +241 -0
- package/autolink/postlink/activityLinker.js +14 -11
- package/autolink/postlink/appDelegateLinker.js +4 -0
- package/autolink/postlink/path.js +0 -2
- package/jest-setup.js +0 -3
- package/jest.config.js +2 -1
- package/lib/Mock/Components/NavigationButton.tsx +4 -2
- package/lib/android/app/build.gradle +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/TopBarOptions.java +8 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +10 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonController.kt +2 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonPresenter.kt +5 -0
- package/lib/android/build.gradle +1 -0
- package/lib/dist/Mock/Components/NavigationButton.js +2 -1
- package/lib/dist/src/interfaces/Options.d.ts +2 -0
- package/lib/ios/RNNButtonOptions.h +3 -1
- package/lib/ios/RNNButtonOptions.m +7 -3
- package/lib/ios/RNNButtonsPresenter.h +6 -2
- package/lib/ios/RNNButtonsPresenter.m +16 -4
- package/lib/ios/RNNComponentPresenter.m +10 -2
- package/lib/ios/RNNIconDrawer.m +1 -1
- package/lib/ios/RNNTitleViewHelper.h +8 -0
- package/lib/ios/RNNTitleViewHelper.m +16 -0
- package/lib/ios/RNNTopBarOptions.h +2 -0
- package/lib/ios/RNNTopBarOptions.m +6 -0
- package/lib/ios/RNNUIBarButtonItem.h +2 -1
- package/lib/ios/RNNUIBarButtonItem.m +31 -8
- package/lib/ios/TopBarTitlePresenter.m +7 -0
- package/lib/src/interfaces/Options.ts +2 -0
- package/package.json +19 -19
- package/react-native.config.js +0 -3
|
@@ -21,13 +21,13 @@ Pod::Spec.new do |s|
|
|
|
21
21
|
s.exclude_files = "lib/ios/ReactNativeNavigationTests/**/*.*", "lib/ios/OCMock/**/*.*"
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
s.subspec 'Fabric' do |ss|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
end
|
|
24
|
+
# s.subspec 'Fabric' do |ss|
|
|
25
|
+
# ss.xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/RCT-Folly\"",
|
|
26
|
+
# "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1" }
|
|
27
|
+
# ss.dependency 'React-RCTFabric'
|
|
28
|
+
# ss.dependency 'React-Fabric'
|
|
29
|
+
# ss.dependency 'RCT-Folly/Fabric'
|
|
30
|
+
# end
|
|
31
31
|
|
|
32
32
|
s.dependency 'React-Core'
|
|
33
33
|
s.dependency 'React-RCTImage'
|
|
@@ -0,0 +1,108 @@
|
|
|
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
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
package com.app;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactActivity;
|
|
4
|
+
import com.facebook.react.ReactActivityDelegate;
|
|
5
|
+
import com.facebook.react.ReactRootView;
|
|
6
|
+
|
|
7
|
+
public class MainActivity extends ReactActivity {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
|
11
|
+
* rendering of the component.
|
|
12
|
+
*/
|
|
13
|
+
@Override
|
|
14
|
+
protected String getMainComponentName() {
|
|
15
|
+
return "app";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
|
|
20
|
+
* you can specify the rendered you wish to use (Fabric or the older renderer).
|
|
21
|
+
*/
|
|
22
|
+
@Override
|
|
23
|
+
protected ReactActivityDelegate createReactActivityDelegate() {
|
|
24
|
+
return new MainActivityDelegate(this, getMainComponentName());
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public static class MainActivityDelegate extends ReactActivityDelegate {
|
|
28
|
+
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
|
|
29
|
+
super(activity, mainComponentName);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@Override
|
|
33
|
+
protected ReactRootView createRootView() {
|
|
34
|
+
ReactRootView reactRootView = new ReactRootView(getContext());
|
|
35
|
+
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
|
|
36
|
+
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
|
|
37
|
+
return reactRootView;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
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
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
package com.app;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactActivity;
|
|
4
|
+
import com.facebook.react.ReactActivityDelegate;
|
|
5
|
+
import com.facebook.react.ReactRootView;
|
|
6
|
+
|
|
7
|
+
public class MainActivity extends ReactActivity {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
|
11
|
+
* rendering of the component.
|
|
12
|
+
*/
|
|
13
|
+
@Override
|
|
14
|
+
protected String getMainComponentName() {
|
|
15
|
+
return "app";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
|
|
20
|
+
* you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
|
|
21
|
+
* (Paper).
|
|
22
|
+
*/
|
|
23
|
+
@Override
|
|
24
|
+
protected ReactActivityDelegate createReactActivityDelegate() {
|
|
25
|
+
return new MainActivityDelegate(this, getMainComponentName());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public static class MainActivityDelegate extends ReactActivityDelegate {
|
|
29
|
+
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
|
|
30
|
+
super(activity, mainComponentName);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@Override
|
|
34
|
+
protected ReactRootView createRootView() {
|
|
35
|
+
ReactRootView reactRootView = new ReactRootView(getContext());
|
|
36
|
+
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
|
|
37
|
+
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
|
|
38
|
+
return reactRootView;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Override
|
|
42
|
+
protected boolean isConcurrentRootEnabled() {
|
|
43
|
+
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
|
|
44
|
+
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
|
|
45
|
+
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`activityLinker should work for RN 0.68 1`] = `
|
|
4
|
+
"package com.app;
|
|
5
|
+
|
|
6
|
+
import com.reactnativenavigation.NavigationActivity;
|
|
7
|
+
import com.facebook.react.ReactActivityDelegate;
|
|
8
|
+
import com.facebook.react.ReactRootView;
|
|
9
|
+
|
|
10
|
+
public class MainActivity extends NavigationActivity {
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
public static class MainActivityDelegate extends ReactActivityDelegate {
|
|
17
|
+
public MainActivityDelegate(NavigationActivity activity, String mainComponentName) {
|
|
18
|
+
super(activity, mainComponentName);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Override
|
|
22
|
+
protected ReactRootView createRootView() {
|
|
23
|
+
ReactRootView reactRootView = new ReactRootView(getContext());
|
|
24
|
+
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
|
|
25
|
+
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
|
|
26
|
+
return reactRootView;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
"
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports[`activityLinker should work for RN 0.69 1`] = `
|
|
34
|
+
"package com.app;
|
|
35
|
+
|
|
36
|
+
import com.reactnativenavigation.NavigationActivity;
|
|
37
|
+
import com.facebook.react.ReactActivityDelegate;
|
|
38
|
+
import com.facebook.react.ReactRootView;
|
|
39
|
+
|
|
40
|
+
public class MainActivity extends NavigationActivity {
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
public static class MainActivityDelegate extends ReactActivityDelegate {
|
|
47
|
+
public MainActivityDelegate(NavigationActivity activity, String mainComponentName) {
|
|
48
|
+
super(activity, mainComponentName);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Override
|
|
52
|
+
protected ReactRootView createRootView() {
|
|
53
|
+
ReactRootView reactRootView = new ReactRootView(getContext());
|
|
54
|
+
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
|
|
55
|
+
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
|
|
56
|
+
return reactRootView;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Override
|
|
60
|
+
protected boolean isConcurrentRootEnabled() {
|
|
61
|
+
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
|
|
62
|
+
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
|
|
63
|
+
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
"
|
|
68
|
+
`;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`appDelegateLinker should work for RN 0.68 1`] = `
|
|
4
|
+
"#import \\"AppDelegate.h\\"
|
|
5
|
+
#import <ReactNativeNavigation/ReactNativeNavigation.h>
|
|
6
|
+
|
|
7
|
+
#import <React/RCTBridge.h>
|
|
8
|
+
#import <React/RCTBundleURLProvider.h>
|
|
9
|
+
|
|
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
|
+
@implementation AppDelegate
|
|
32
|
+
|
|
33
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
34
|
+
{
|
|
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
|
+
|
|
51
|
+
|
|
52
|
+
return YES;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge {
|
|
56
|
+
return [ReactNativeNavigation extraModulesForBridge:bridge];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
|
|
60
|
+
{
|
|
61
|
+
#if DEBUG
|
|
62
|
+
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@\\"index\\"];
|
|
63
|
+
#else
|
|
64
|
+
return [[NSBundle mainBundle] URLForResource:@\\"main\\" withExtension:@\\"jsbundle\\"];
|
|
65
|
+
#endif
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
69
|
+
|
|
70
|
+
#pragma mark - RCTCxxBridgeDelegate
|
|
71
|
+
|
|
72
|
+
- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
|
|
73
|
+
{
|
|
74
|
+
_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
|
|
75
|
+
delegate:self
|
|
76
|
+
jsInvoker:bridge.jsCallInvoker];
|
|
77
|
+
return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
#pragma mark RCTTurboModuleManagerDelegate
|
|
81
|
+
|
|
82
|
+
- (Class)getModuleClassFromName:(const char *)name
|
|
83
|
+
{
|
|
84
|
+
return RCTCoreModulesClassProvider(name);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
|
88
|
+
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
|
|
89
|
+
{
|
|
90
|
+
return nullptr;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
|
94
|
+
initParams:
|
|
95
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
96
|
+
{
|
|
97
|
+
return nullptr;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
|
|
101
|
+
{
|
|
102
|
+
return RCTAppSetupDefaultModuleFromClass(moduleClass);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
#endif
|
|
106
|
+
|
|
107
|
+
@end
|
|
108
|
+
"
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
exports[`appDelegateLinker should work for RN 0.69 1`] = `
|
|
112
|
+
"#import \\"AppDelegate.h\\"
|
|
113
|
+
#import <ReactNativeNavigation/ReactNativeNavigation.h>
|
|
114
|
+
|
|
115
|
+
#import <React/RCTBridge.h>
|
|
116
|
+
#import <React/RCTBundleURLProvider.h>
|
|
117
|
+
|
|
118
|
+
#import <React/RCTAppSetupUtils.h>
|
|
119
|
+
|
|
120
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
121
|
+
#import <React/CoreModulesPlugins.h>
|
|
122
|
+
#import <React/RCTCxxBridgeDelegate.h>
|
|
123
|
+
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
|
|
124
|
+
#import <React/RCTSurfacePresenter.h>
|
|
125
|
+
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
|
126
|
+
#import <ReactCommon/RCTTurboModuleManager.h>
|
|
127
|
+
|
|
128
|
+
#import <react/config/ReactNativeConfig.h>
|
|
129
|
+
|
|
130
|
+
static NSString *const kRNConcurrentRoot = @\\"concurrentRoot\\";
|
|
131
|
+
|
|
132
|
+
@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
|
|
133
|
+
RCTTurboModuleManager *_turboModuleManager;
|
|
134
|
+
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
|
|
135
|
+
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
|
|
136
|
+
facebook::react::ContextContainer::Shared _contextContainer;
|
|
137
|
+
}
|
|
138
|
+
@end
|
|
139
|
+
#endif
|
|
140
|
+
|
|
141
|
+
@implementation AppDelegate
|
|
142
|
+
|
|
143
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
144
|
+
{
|
|
145
|
+
RCTAppSetupPrepareApp(application);
|
|
146
|
+
|
|
147
|
+
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
148
|
+
[ReactNativeNavigation bootstrapWithBridge:bridge];
|
|
149
|
+
|
|
150
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
151
|
+
_contextContainer = std::make_shared<facebook::react::ContextContainer const>();
|
|
152
|
+
_reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
|
|
153
|
+
_contextContainer->insert(\\"ReactNativeConfig\\", _reactNativeConfig);
|
|
154
|
+
_bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
|
|
155
|
+
bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
|
|
156
|
+
#endif
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
return YES;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/// This method controls whether the \`concurrentRoot\`feature of React18 is turned on or off.
|
|
166
|
+
///
|
|
167
|
+
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
|
|
168
|
+
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
|
|
169
|
+
/// @return: \`true\` if the \`concurrentRoot\` feture is enabled. Otherwise, it returns \`false\`.
|
|
170
|
+
- (BOOL)concurrentRootEnabled
|
|
171
|
+
{
|
|
172
|
+
// Switch this bool to turn on and off the concurrent root
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
- (NSDictionary *)prepareInitialProps
|
|
177
|
+
{
|
|
178
|
+
NSMutableDictionary *initProps = [NSMutableDictionary new];
|
|
179
|
+
|
|
180
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
181
|
+
initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
|
|
182
|
+
#endif
|
|
183
|
+
|
|
184
|
+
return initProps;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge {
|
|
188
|
+
return [ReactNativeNavigation extraModulesForBridge:bridge];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
|
|
192
|
+
{
|
|
193
|
+
#if DEBUG
|
|
194
|
+
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@\\"index\\"];
|
|
195
|
+
#else
|
|
196
|
+
return [[NSBundle mainBundle] URLForResource:@\\"main\\" withExtension:@\\"jsbundle\\"];
|
|
197
|
+
#endif
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
201
|
+
|
|
202
|
+
#pragma mark - RCTCxxBridgeDelegate
|
|
203
|
+
|
|
204
|
+
- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
|
|
205
|
+
{
|
|
206
|
+
_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
|
|
207
|
+
delegate:self
|
|
208
|
+
jsInvoker:bridge.jsCallInvoker];
|
|
209
|
+
return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
#pragma mark RCTTurboModuleManagerDelegate
|
|
213
|
+
|
|
214
|
+
- (Class)getModuleClassFromName:(const char *)name
|
|
215
|
+
{
|
|
216
|
+
return RCTCoreModulesClassProvider(name);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
|
220
|
+
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
|
|
221
|
+
{
|
|
222
|
+
return nullptr;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
|
226
|
+
initParams:
|
|
227
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
228
|
+
{
|
|
229
|
+
return nullptr;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
|
|
233
|
+
{
|
|
234
|
+
return RCTAppSetupDefaultModuleFromClass(moduleClass);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
#endif
|
|
238
|
+
|
|
239
|
+
@end
|
|
240
|
+
"
|
|
241
|
+
`;
|