react-native-navigation 7.29.0 → 7.29.1
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/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.config.js +1 -0
- package/lib/android/app/build.gradle +24 -3
- package/lib/android/app/src/main/AndroidManifest.xml +4 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java +12 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonPresenter.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/BaseViewAnimator.kt +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/IconBackgroundDrawable.kt +9 -11
- package/lib/android/build.gradle +1 -0
- package/lib/ios/RNNUIBarButtonItem.m +2 -2
- package/package.json +2 -1
|
@@ -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
|
+
`;
|
|
@@ -69,19 +69,24 @@ class ActivityLinker {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
_extendNavigationActivity(activityContent) {
|
|
72
|
+
if (this._hasAlreadyExtendNavigationActivity(activityContent)) {
|
|
73
|
+
warnn(' MainActivity already extends NavigationActivity');
|
|
74
|
+
return activityContent;
|
|
75
|
+
}
|
|
76
|
+
|
|
72
77
|
if (this._doesActivityExtendReactActivity(activityContent)) {
|
|
73
78
|
debugn(' Extending NavigationActivity');
|
|
74
79
|
return activityContent
|
|
75
80
|
.replace(/extends\s+ReactActivity\s*/, 'extends NavigationActivity ')
|
|
81
|
+
.replace(
|
|
82
|
+
/public\s+MainActivityDelegate\s*\(\s*ReactActivity\s+activity,\s*String\s+mainComponentName\s*\)/,
|
|
83
|
+
'public MainActivityDelegate(NavigationActivity activity, String mainComponentName)'
|
|
84
|
+
)
|
|
76
85
|
.replace(
|
|
77
86
|
'import com.facebook.react.ReactActivity;',
|
|
78
87
|
'import com.reactnativenavigation.NavigationActivity;'
|
|
79
88
|
);
|
|
80
89
|
}
|
|
81
|
-
if (this._hasAlreadyExtendReactActivity(activityContent)) {
|
|
82
|
-
warnn(' MainActivity already extends NavigationActivity');
|
|
83
|
-
return activityContent;
|
|
84
|
-
}
|
|
85
90
|
|
|
86
91
|
throw new Error(
|
|
87
92
|
'MainActivity was not successfully replaced. Please check the documentation and proceed manually.'
|
|
@@ -92,8 +97,8 @@ class ActivityLinker {
|
|
|
92
97
|
return /public\s+class\s+MainActivity\s+extends\s+ReactActivity\s*/.test(activityContent);
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
|
|
96
|
-
return /public\s+class\s+MainActivity\s+extends\s+
|
|
100
|
+
_hasAlreadyExtendNavigationActivity(activityContent) {
|
|
101
|
+
return /public\s+class\s+MainActivity\s+extends\s+NavigationActivity\s*/.test(activityContent);
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
_removeCreateReactActivityDelegate(activityContent) {
|
|
@@ -101,19 +106,17 @@ class ActivityLinker {
|
|
|
101
106
|
debugn(' Removing createReactActivityDelegate function');
|
|
102
107
|
return activityContent.replace(
|
|
103
108
|
/\/\*\*(\s+\*.+)+\s+@Override\s+protected ReactActivityDelegate createReactActivityDelegate\(\) {(\s*[\w*(,);])*\s*}/,
|
|
104
|
-
''
|
|
109
|
+
''
|
|
105
110
|
);
|
|
106
111
|
} else {
|
|
107
|
-
warnn(
|
|
108
|
-
' createReactActivityDelegate is already not defined in MainActivity',
|
|
109
|
-
);
|
|
112
|
+
warnn(' createReactActivityDelegate is already not defined in MainActivity');
|
|
110
113
|
return activityContent;
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
_hasCreateReactActivityDelegate(activityContent) {
|
|
115
118
|
return /\/\*\*(\s+\*.+)+\s+@Override\s+protected ReactActivityDelegate createReactActivityDelegate\(\) {(\s*[\w*(,);])*\s*}/.test(
|
|
116
|
-
activityContent
|
|
119
|
+
activityContent
|
|
117
120
|
);
|
|
118
121
|
}
|
|
119
122
|
}
|
|
@@ -153,7 +153,11 @@ class AppDelegateLinker {
|
|
|
153
153
|
/rootViewController\.view\s+=\s+rootView;\s+/,
|
|
154
154
|
/self.window.rootViewController\s+=\s+rootViewController;\s+/,
|
|
155
155
|
/\[self.window\s+makeKeyAndVisible];\s+/,
|
|
156
|
+
// Added from RN 0.69
|
|
157
|
+
/NSDictionary\s+\*initProps\s+=\s+\[self prepareInitialProps];\s+/,
|
|
158
|
+
/UIView \*rootView = RCTAppSetupDefaultRootView\(bridge, @".*", initProps\);/,
|
|
156
159
|
];
|
|
160
|
+
|
|
157
161
|
let elementsRemovedCount = 0;
|
|
158
162
|
|
|
159
163
|
toRemove.forEach((element) => {
|
|
@@ -3,8 +3,6 @@ var ignoreFolders = {
|
|
|
3
3
|
ignore: ['node_modules/**', '**/build/**', '**/Build/**', '**/DerivedData/**', '**/*-tvOS*/**'],
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
-
var manifestPath = glob.sync('**/AndroidManifest.xml', ignoreFolders)[0];
|
|
7
|
-
|
|
8
6
|
exports.mainActivityJava = glob.sync('**/MainActivity.java', ignoreFolders)[0];
|
|
9
7
|
exports.mainActivityKotlin = glob.sync('**/MainActivity.kt', ignoreFolders)[0];
|
|
10
8
|
var mainApplicationJava = glob.sync('**/MainApplication.java', ignoreFolders)[0];
|
package/jest.config.js
CHANGED
|
@@ -12,9 +12,9 @@ def safeExtGetFallbackLowerBound(prop, fallback) {
|
|
|
12
12
|
Math.max(safeExtGet(prop,fallback),fallback)
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
def DEFAULT_COMPILE_SDK_VERSION =
|
|
15
|
+
def DEFAULT_COMPILE_SDK_VERSION = 33
|
|
16
16
|
def DEFAULT_MIN_SDK_VERSION = 21
|
|
17
|
-
def DEFAULT_TARGET_SDK_VERSION =
|
|
17
|
+
def DEFAULT_TARGET_SDK_VERSION = 33
|
|
18
18
|
def DEFAULT_KOTLIN_VERSION = "1.5.31"
|
|
19
19
|
def DEFAULT_KOTLIN_STDLIB = 'kotlin-stdlib-jdk8'
|
|
20
20
|
def kotlinVersion = safeExtGet("RNNKotlinVersion", DEFAULT_KOTLIN_VERSION)
|
|
@@ -22,7 +22,7 @@ def kotlinStdlib = safeExtGet('RNNKotlinStdlib',DEFAULT_KOTLIN_STDLIB )
|
|
|
22
22
|
def kotlinCoroutinesCore = safeExtGet('RNNKotlinCoroutinesCore', '1.5.2')
|
|
23
23
|
android {
|
|
24
24
|
compileSdkVersion safeExtGetFallbackLowerBound('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
|
|
25
|
-
|
|
25
|
+
buildToolsVersion = "33.0.0"
|
|
26
26
|
defaultConfig {
|
|
27
27
|
minSdkVersion safeExtGetFallbackLowerBound('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
|
|
28
28
|
targetSdkVersion safeExtGetFallbackLowerBound('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
|
|
@@ -167,6 +167,27 @@ List reactNativeVersionComponents(rnPackageJsonFile) {
|
|
|
167
167
|
return reactNativeVersion.tokenize('-')[0].tokenize('.')
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
task installBuildToolsAndRenameD8IfNeeded {
|
|
171
|
+
def buildToolsVersion = android.getBuildToolsVersion()
|
|
172
|
+
def sdkDir = android.sdkDirectory
|
|
173
|
+
def buildToolsDir = new File(sdkDir, "/build-tools/" + buildToolsVersion)
|
|
174
|
+
|
|
175
|
+
if (!buildToolsDir.exists()) {
|
|
176
|
+
def command = sdkDir.absolutePath + "/cmdline-tools/latest/bin/sdkmanager build-tools;" + buildToolsVersion
|
|
177
|
+
command.execute().waitForProcessOutput(System.out, System.err)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
def d8File = new File(buildToolsDir, "d8")
|
|
181
|
+
def dxFile = new File(buildToolsDir, "dx")
|
|
182
|
+
d8File.renameTo(dxFile)
|
|
183
|
+
|
|
184
|
+
def buildToolsLibDir = new File(buildToolsDir, "lib")
|
|
185
|
+
d8File = new File(buildToolsLibDir, "d8.jar")
|
|
186
|
+
dxFile = new File(buildToolsLibDir, "dx.jar")
|
|
187
|
+
d8File.renameTo(dxFile)
|
|
188
|
+
}
|
|
189
|
+
build.dependsOn installBuildToolsAndRenameD8IfNeeded
|
|
190
|
+
|
|
170
191
|
dependencies {
|
|
171
192
|
|
|
172
193
|
implementation "androidx.core:core-ktx:1.6.0"
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
-
|
|
2
|
+
xmlns:tools="http://schemas.android.com/tools"
|
|
3
|
+
package="com.reactnativenavigation">
|
|
3
4
|
|
|
4
|
-
<application
|
|
5
|
+
<application
|
|
6
|
+
android:enableOnBackInvokedCallback="true">
|
|
5
7
|
<activity
|
|
6
8
|
android:name="com.facebook.react.devsupport.DevSettingsActivity"
|
|
7
9
|
android:exported="false"/>
|
|
@@ -22,6 +22,7 @@ import com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry;
|
|
|
22
22
|
import com.reactnativenavigation.viewcontrollers.modal.ModalStack;
|
|
23
23
|
import com.reactnativenavigation.viewcontrollers.navigator.Navigator;
|
|
24
24
|
|
|
25
|
+
import androidx.activity.OnBackPressedCallback;
|
|
25
26
|
import androidx.annotation.NonNull;
|
|
26
27
|
import androidx.annotation.Nullable;
|
|
27
28
|
import androidx.appcompat.app.AppCompatActivity;
|
|
@@ -47,6 +48,7 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
|
|
|
47
48
|
);
|
|
48
49
|
navigator.bindViews();
|
|
49
50
|
getReactGateway().onActivityCreated(this);
|
|
51
|
+
setBackPressedCallback();
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
@Override
|
|
@@ -103,11 +105,6 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
|
|
|
103
105
|
getReactGateway().onActivityResult(this, requestCode, resultCode, data);
|
|
104
106
|
}
|
|
105
107
|
|
|
106
|
-
@Override
|
|
107
|
-
public void onBackPressed() {
|
|
108
|
-
getReactGateway().onBackPressed();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
108
|
@Override
|
|
112
109
|
public boolean onKeyUp(final int keyCode, final KeyEvent event) {
|
|
113
110
|
return getReactGateway().onKeyUp(this, keyCode) || super.onKeyUp(keyCode, event);
|
|
@@ -152,4 +149,14 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
|
|
|
152
149
|
public void onCatalystInstanceDestroy() {
|
|
153
150
|
runOnUiThread(() -> navigator.destroyViews());
|
|
154
151
|
}
|
|
152
|
+
|
|
153
|
+
private void setBackPressedCallback() {
|
|
154
|
+
OnBackPressedCallback callback = new OnBackPressedCallback(true) {
|
|
155
|
+
@Override
|
|
156
|
+
public void handleOnBackPressed() {
|
|
157
|
+
getReactGateway().onBackPressed();
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
getOnBackPressedDispatcher().addCallback(this, callback);
|
|
161
|
+
}
|
|
155
162
|
}
|
|
@@ -74,7 +74,7 @@ open class ButtonPresenter(private val context: Context, private val button: But
|
|
|
74
74
|
private fun applyAccessibilityLabel(menuItem: MenuItem) {
|
|
75
75
|
if (button.accessibilityLabel.hasValue()) {
|
|
76
76
|
if (button.component.hasValue()) {
|
|
77
|
-
menuItem.actionView
|
|
77
|
+
menuItem.actionView?.contentDescription = button.accessibilityLabel.get()
|
|
78
78
|
} else {
|
|
79
79
|
MenuItemCompat.setContentDescription(menuItem, button.accessibilityLabel.get())
|
|
80
80
|
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/BaseViewAnimator.kt
CHANGED
|
@@ -43,17 +43,17 @@ open class BaseViewAnimator<T : View>(
|
|
|
43
43
|
private inner class AnimatorListener(private val startState: AnimationState, private val endVisibility: Int) : AnimatorListenerAdapter() {
|
|
44
44
|
var isCancelled = false
|
|
45
45
|
|
|
46
|
-
override fun onAnimationStart(animation: Animator
|
|
46
|
+
override fun onAnimationStart(animation: Animator) {
|
|
47
47
|
view.resetViewProperties()
|
|
48
48
|
view.visibility = View.VISIBLE
|
|
49
49
|
animationState = startState
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
override fun onAnimationCancel(animation: Animator
|
|
52
|
+
override fun onAnimationCancel(animation: Animator) {
|
|
53
53
|
isCancelled = true
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
override fun onAnimationEnd(animation: Animator
|
|
56
|
+
override fun onAnimationEnd(animation: Animator) {
|
|
57
57
|
if (!isCancelled) {
|
|
58
58
|
animationState = AnimationState.Idle
|
|
59
59
|
view.visibility = endVisibility
|
|
@@ -68,17 +68,15 @@ class IconBackgroundDrawable(
|
|
|
68
68
|
super.setBounds(r)
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
override fun onBoundsChange(bounds: Rect
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
bounds.height() - (bounds.height() - bitmapHeight) / 2)
|
|
81
|
-
}
|
|
71
|
+
override fun onBoundsChange(bounds: Rect) {
|
|
72
|
+
backgroundRect = Rect((bounds.width() - backgroundWidth) / 2,
|
|
73
|
+
(bounds.height() - backgroundHeight) / 2,
|
|
74
|
+
bounds.width() - (bounds.width() - backgroundWidth) / 2,
|
|
75
|
+
bounds.height() - (bounds.height() - backgroundHeight) / 2)
|
|
76
|
+
bitmapRect = Rect((bounds.width() - bitmapWidth) / 2,
|
|
77
|
+
(bounds.height() - bitmapHeight) / 2,
|
|
78
|
+
bounds.width() - (bounds.width() - bitmapWidth) / 2,
|
|
79
|
+
bounds.height() - (bounds.height() - bitmapHeight) / 2)
|
|
82
80
|
super.onBoundsChange(bounds)
|
|
83
81
|
}
|
|
84
82
|
|
package/lib/android/build.gradle
CHANGED
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
UIImage *icon = [iconCreator create:buttonOptions];
|
|
56
56
|
UIButton *button =
|
|
57
57
|
[[UIButton alloc] initWithFrame:CGRectMake(0, 0, icon.size.width, icon.size.height)];
|
|
58
|
-
|
|
59
58
|
[button addTarget:self
|
|
60
59
|
action:@selector(onButtonPressed:)
|
|
61
60
|
forControlEvents:UIControlEventTouchUpInside];
|
|
62
61
|
[button setImage:icon
|
|
63
62
|
forState:buttonOptions.isEnabled ? UIControlStateNormal : UIControlStateDisabled];
|
|
64
|
-
|
|
63
|
+
[button.widthAnchor constraintEqualToConstant:icon.size.width].active = YES;
|
|
64
|
+
[button.heightAnchor constraintEqualToConstant:icon.size.height].active = YES;
|
|
65
65
|
self = [super initWithCustomView:button];
|
|
66
66
|
[self applyOptions:buttonOptions];
|
|
67
67
|
self.onPress = onPress;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-navigation",
|
|
3
|
-
"version": "7.29.
|
|
3
|
+
"version": "7.29.1",
|
|
4
4
|
"description": "React Native Navigation - truly native navigation for iOS and Android",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"nativePackage": true,
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"pretest-e2e-ios": "npm run build",
|
|
44
44
|
"test-e2e-ios": "node ./scripts/test-e2e --ios",
|
|
45
45
|
"test-e2e-ios-multi": "npm run test-e2e-ios -- --multi",
|
|
46
|
+
"test-autolink": "node ./scripts/test-autolink",
|
|
46
47
|
"test-all": "node ./scripts/test-all",
|
|
47
48
|
"prerelease": "npm run build",
|
|
48
49
|
"release": "node ./scripts/release",
|