hybrid-navigation 2.16.11 → 2.17.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/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java +8 -7
- package/ios/HybridNavigation/Navigator/HBDDrawerNavigator.m +1 -15
- package/ios/HybridNavigation/Navigator/HBDScreenNavigator.m +1 -15
- package/ios/HybridNavigation/Navigator/HBDStackNavigator.m +1 -15
- package/ios/HybridNavigation/Navigator/HBDTabNavigator.m +1 -15
- package/ios/HybridNavigation/View/HBDBackBarButtonItem.h +9 -0
- package/ios/HybridNavigation/View/HBDBackBarButtonItem.m +13 -0
- package/ios/HybridNavigation/ViewController/HBDNavigationController.m +1 -15
- package/ios/HybridNavigation/ViewController/HBDViewController.m +4 -4
- package/ios/HybridNavigation/ViewController/UIViewController+HBD.h +1 -0
- package/ios/HybridNavigation/ViewController/UIViewController+HBD.m +33 -3
- package/lib/NavigationComponentWrap.d.ts +0 -6
- package/lib/NavigationComponentWrap.js +0 -2
- package/lib/Navigator.d.ts +2 -43
- package/lib/Navigator.js +1 -59
- package/lib/hooks.d.ts +0 -5
- package/lib/hooks.js +0 -8
- package/lib/index.d.ts +1 -3
- package/lib/index.js +0 -2
- package/package.json +1 -1
- package/src/NavigationComponentWrap.tsx +0 -10
- package/src/Navigator.ts +2 -77
- package/src/hooks.ts +0 -9
- package/src/index.ts +1 -3
- package/lib/Garden.d.ts +0 -65
- package/lib/Garden.js +0 -81
- package/lib/ReactRegistry.d.ts +0 -25
- package/lib/ReactRegistry.js +0 -29
- package/src/Garden.ts +0 -103
- package/src/ReactRegistry.tsx +0 -39
package/android/build.gradle
CHANGED
|
@@ -33,5 +33,5 @@ dependencies {
|
|
|
33
33
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
34
34
|
implementation 'com.facebook.react:react-native:+'
|
|
35
35
|
// api project(':navigation')
|
|
36
|
-
api 'io.github.listenzz:AndroidNavigation:13.6.
|
|
36
|
+
api 'io.github.listenzz:AndroidNavigation:13.6.6'
|
|
37
37
|
}
|
package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java
CHANGED
|
@@ -120,7 +120,7 @@ public class ScreenNavigator implements Navigator {
|
|
|
120
120
|
callback.invoke(null, false);
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
ReadableMap layout = extras.getMap("layout");
|
|
125
125
|
presented = getReactBridgeManager().createFragment(layout);
|
|
126
126
|
if (presented == null) {
|
|
@@ -138,7 +138,7 @@ public class ScreenNavigator implements Navigator {
|
|
|
138
138
|
callback.invoke(null, false);
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
|
|
142
142
|
ReadableMap layout = extras.getMap("layout");
|
|
143
143
|
presented = getReactBridgeManager().createFragment(layout);
|
|
144
144
|
if (presented == null) {
|
|
@@ -155,7 +155,7 @@ public class ScreenNavigator implements Navigator {
|
|
|
155
155
|
callback.invoke(null, false);
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
|
|
159
159
|
presented = createFragmentWithExtras(extras);
|
|
160
160
|
if (presented == null) {
|
|
161
161
|
callback.invoke(null, false);
|
|
@@ -163,15 +163,16 @@ public class ScreenNavigator implements Navigator {
|
|
|
163
163
|
}
|
|
164
164
|
presented.setPresentationStyle(PresentationStyle.OverFullScreen);
|
|
165
165
|
int requestCode = extras.getInt("requestCode");
|
|
166
|
+
|
|
166
167
|
presenting.presentFragment(presented, requestCode, () -> callback.invoke(null, true), TransitionAnimation.Fade);
|
|
167
168
|
}
|
|
168
169
|
|
|
169
|
-
private void handleHideModal(@NonNull AwesomeFragment
|
|
170
|
-
|
|
170
|
+
private void handleHideModal(@NonNull AwesomeFragment presented, @NonNull Callback callback) {
|
|
171
|
+
presented.dismissFragment(() -> callback.invoke(null, true), TransitionAnimation.Fade);
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
private void handleDismiss(@NonNull AwesomeFragment
|
|
174
|
-
|
|
174
|
+
private void handleDismiss(@NonNull AwesomeFragment presented, @NonNull Callback callback) {
|
|
175
|
+
presented.dismissFragment(() -> callback.invoke(null, true));
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
private void handlePresent(@NonNull AwesomeFragment presenting, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
@@ -94,16 +94,6 @@
|
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
if (!drawer.hbd_viewAppeared) {
|
|
98
|
-
[self performSelector:@selector(handleNavigation:) withObject:@{
|
|
99
|
-
@"viewController": vc,
|
|
100
|
-
@"action": action,
|
|
101
|
-
@"extras": extras,
|
|
102
|
-
@"callback": callback,
|
|
103
|
-
} afterDelay:0.05];
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
97
|
callback(@[NSNull.null, @YES]);
|
|
108
98
|
|
|
109
99
|
if ([action isEqualToString:@"toggleMenu"]) {
|
|
@@ -122,12 +112,8 @@
|
|
|
122
112
|
}
|
|
123
113
|
}
|
|
124
114
|
|
|
125
|
-
-(void)handleNavigation:(NSDictionary *)params {
|
|
126
|
-
[self handleNavigationWithViewController:params[@"viewController"] action:params[@"action"] extras:params[@"extras"] callback:params[@"callback"]];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
115
|
- (void)invalidate {
|
|
130
|
-
|
|
116
|
+
//
|
|
131
117
|
}
|
|
132
118
|
|
|
133
119
|
@end
|
|
@@ -55,16 +55,6 @@
|
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
if (!vc.hbd_viewAppeared) {
|
|
59
|
-
[self performSelector:@selector(handleNavigation:) withObject:@{
|
|
60
|
-
@"viewController": vc,
|
|
61
|
-
@"action": action,
|
|
62
|
-
@"extras": extras,
|
|
63
|
-
@"callback": callback,
|
|
64
|
-
} afterDelay:0.05];
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
58
|
if ([action isEqualToString:@"present"]) {
|
|
69
59
|
[self handlePresentWithViewController:vc extras:extras callback:callback];
|
|
70
60
|
return;
|
|
@@ -161,12 +151,8 @@
|
|
|
161
151
|
return [[HBDReactBridgeManager get] viewControllerWithModuleName:moduleName props:props options:options];
|
|
162
152
|
}
|
|
163
153
|
|
|
164
|
-
-(void)handleNavigation:(NSDictionary *)params {
|
|
165
|
-
[self handleNavigationWithViewController:params[@"viewController"] action:params[@"action"] extras:params[@"extras"] callback:params[@"callback"]];
|
|
166
|
-
}
|
|
167
|
-
|
|
168
154
|
- (void)invalidate {
|
|
169
|
-
|
|
155
|
+
//
|
|
170
156
|
}
|
|
171
157
|
|
|
172
158
|
@end
|
|
@@ -82,16 +82,6 @@
|
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
if (!nav.hbd_viewAppeared) {
|
|
86
|
-
[self performSelector:@selector(handleNavigation:) withObject:@{
|
|
87
|
-
@"viewController": vc,
|
|
88
|
-
@"action": action,
|
|
89
|
-
@"extras": extras,
|
|
90
|
-
@"callback": callback,
|
|
91
|
-
} afterDelay:0.05];
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
85
|
if ([action isEqualToString:@"push"]) {
|
|
96
86
|
[self handlePushWithNavigationController:nav extras:extras callback:callback];
|
|
97
87
|
return;
|
|
@@ -257,12 +247,8 @@
|
|
|
257
247
|
return drawer.contentController.navigationController;
|
|
258
248
|
}
|
|
259
249
|
|
|
260
|
-
-(void)handleNavigation:(NSDictionary *)params {
|
|
261
|
-
[self handleNavigationWithViewController:params[@"viewController"] action:params[@"action"] extras:params[@"extras"] callback:params[@"callback"]];
|
|
262
|
-
}
|
|
263
|
-
|
|
264
250
|
- (void)invalidate {
|
|
265
|
-
|
|
251
|
+
//
|
|
266
252
|
}
|
|
267
253
|
|
|
268
254
|
@end
|
|
@@ -187,28 +187,14 @@
|
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
if (!tabBarController.hbd_viewAppeared) {
|
|
191
|
-
[self performSelector:@selector(handleNavigation:) withObject:@{
|
|
192
|
-
@"viewController": vc,
|
|
193
|
-
@"action": action,
|
|
194
|
-
@"extras": extras,
|
|
195
|
-
@"callback": callback,
|
|
196
|
-
} afterDelay:0.05];
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
190
|
if ([action isEqualToString:@"switchTab"]) {
|
|
201
191
|
[self handleSwitchTabWithTabBarController:tabBarController extras:extras callback:callback];
|
|
202
192
|
return;
|
|
203
193
|
}
|
|
204
194
|
}
|
|
205
195
|
|
|
206
|
-
-(void)handleNavigation:(NSDictionary *)params {
|
|
207
|
-
[self handleNavigationWithViewController:params[@"viewController"] action:params[@"action"] extras:params[@"extras"] callback:params[@"callback"]];
|
|
208
|
-
}
|
|
209
|
-
|
|
210
196
|
- (void)invalidate {
|
|
211
|
-
|
|
197
|
+
//
|
|
212
198
|
}
|
|
213
199
|
|
|
214
200
|
@end
|
|
@@ -587,21 +587,7 @@
|
|
|
587
587
|
}
|
|
588
588
|
|
|
589
589
|
- (CGRect)fakeBarFrameForViewController:(UIViewController *)vc {
|
|
590
|
-
|
|
591
|
-
CGRect frame = [self.navigationBar convertRect:back.frame toView:vc.view];
|
|
592
|
-
frame.origin.x = 0;
|
|
593
|
-
if ((vc.edgesForExtendedLayout & UIRectEdgeTop) == 0) {
|
|
594
|
-
frame.origin.y = -frame.size.height;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
// fix issue for pushed to UIViewController whose root view is UIScrollView.
|
|
598
|
-
if ([vc.view isKindOfClass:[UIScrollView class]]) {
|
|
599
|
-
UIScrollView *scrollView = (UIScrollView *) vc.view;
|
|
600
|
-
scrollView.clipsToBounds = NO;
|
|
601
|
-
if (scrollView.contentOffset.y == 0) {
|
|
602
|
-
frame.origin.y = -frame.size.height;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
590
|
+
CGRect frame = CGRectMake(0, 0, self.navigationBar.frame.size.width, UIApplication.sharedApplication.statusBarFrame.size.height + self.navigationBar.frame.size.height);
|
|
605
591
|
return frame;
|
|
606
592
|
}
|
|
607
593
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#import "HBDUtils.h"
|
|
5
5
|
#import "HBDAnimationObserver.h"
|
|
6
6
|
#import "GlobalStyle.h"
|
|
7
|
+
#import "HBDBackBarButtonItem.h"
|
|
7
8
|
|
|
8
9
|
#import <React/RCTLog.h>
|
|
9
10
|
|
|
@@ -205,17 +206,16 @@
|
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
if ([GlobalStyle globalStyle].isBackTitleHidden) {
|
|
209
|
+
UIBarButtonItem *buttonItem = [[HBDBackBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:NULL];
|
|
210
|
+
self.navigationItem.backBarButtonItem = buttonItem;
|
|
208
211
|
if (@available(iOS 14.0, *)) {
|
|
209
212
|
self.navigationItem.backButtonDisplayMode = UINavigationItemBackButtonDisplayModeMinimal;
|
|
210
|
-
} else {
|
|
211
|
-
UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:NULL];
|
|
212
|
-
self.navigationItem.backBarButtonItem = buttonItem;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
NSDictionary *backItem = options[@"backItemIOS"];
|
|
217
217
|
if (backItem) {
|
|
218
|
-
UIBarButtonItem *backButton = [[
|
|
218
|
+
UIBarButtonItem *backButton = [[HBDBackBarButtonItem alloc] init];
|
|
219
219
|
backButton.title = backItem[@"title"];
|
|
220
220
|
NSString *tintColor = backItem[@"tintColor"];
|
|
221
221
|
if (tintColor) {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
- (void)hbd_setNeedsUpdateNavigationBar;
|
|
23
23
|
|
|
24
24
|
@property(nonatomic, copy, readonly) NSString *sceneId;
|
|
25
|
+
@property(nonatomic, copy) NSString *presentingSceneId;
|
|
25
26
|
@property(nonatomic, assign) NSInteger resultCode;
|
|
26
27
|
@property(nonatomic, assign) NSInteger requestCode;
|
|
27
28
|
@property(nonatomic, copy) NSDictionary *resultData;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
self.hbd_viewAppeared = NO;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
- (void)hbd_presentViewController:(UIViewController *)viewController animated:(BOOL)
|
|
39
|
+
- (void)hbd_presentViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(void (^)(void))completion {
|
|
40
40
|
if (![self canPresentViewController]) {
|
|
41
41
|
[self didReceiveResultCode:0 resultData:nil requestCode:viewController.requestCode];
|
|
42
42
|
if (completion) {
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
}
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
viewController.presentingSceneId = self.sceneId;
|
|
48
|
+
[self hbd_presentViewController:viewController animated:animated completion:completion];
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
- (BOOL)canPresentViewController {
|
|
@@ -66,7 +67,10 @@
|
|
|
66
67
|
|
|
67
68
|
[self hbd_dismissViewControllerAnimated:animated completion:^{
|
|
68
69
|
if (![presented isKindOfClass:[UIAlertController class]]) {
|
|
69
|
-
|
|
70
|
+
BOOL consumed = presented.presentingSceneId && [UIViewController dispatchResult:presenting presented:presented sceneId:presented.presentingSceneId];
|
|
71
|
+
if (!consumed) {
|
|
72
|
+
[presenting didReceiveResultCode:presented.resultCode resultData:presented.resultData requestCode:presented.requestCode];
|
|
73
|
+
}
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
if (completion) {
|
|
@@ -75,6 +79,24 @@
|
|
|
75
79
|
}];
|
|
76
80
|
}
|
|
77
81
|
|
|
82
|
+
+ (BOOL)dispatchResult:(UIViewController *)presenting presented:(UIViewController *)presented sceneId:(NSString *)sceneId {
|
|
83
|
+
if ([sceneId isEqualToString:presenting.sceneId]) {
|
|
84
|
+
[presenting didReceiveResultCode:presented.resultCode resultData:presented.resultData requestCode:presented.requestCode];
|
|
85
|
+
return YES;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
NSArray<UIViewController *> *children = presenting.childViewControllers;
|
|
89
|
+
for (UIViewController *vc in children) {
|
|
90
|
+
BOOL consumed = [self dispatchResult:vc presented:presented sceneId:sceneId];
|
|
91
|
+
if (consumed) {
|
|
92
|
+
return YES;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return NO;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
78
100
|
- (NSString *)sceneId {
|
|
79
101
|
id obj = objc_getAssociatedObject(self, _cmd);
|
|
80
102
|
if (!obj) {
|
|
@@ -302,6 +324,14 @@
|
|
|
302
324
|
self.resultData = data;
|
|
303
325
|
}
|
|
304
326
|
|
|
327
|
+
- (NSString *)presentingSceneId {
|
|
328
|
+
return objc_getAssociatedObject(self, _cmd);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
- (void)setPresentingSceneId:(NSString *)presentingSceneId {
|
|
332
|
+
objc_setAssociatedObject(self, @selector(presentingSceneId), presentingSceneId, OBJC_ASSOCIATION_COPY_NONATOMIC);
|
|
333
|
+
}
|
|
334
|
+
|
|
305
335
|
- (void)didReceiveResultCode:(NSInteger)resultCode resultData:(NSDictionary *)data requestCode:(NSInteger)requestCode {
|
|
306
336
|
if ([self isKindOfClass:[UITabBarController class]]) {
|
|
307
337
|
UIViewController *child = ((UITabBarController *) self).selectedViewController;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Garden } from './Garden';
|
|
3
2
|
import type { NavigationItem } from './Options';
|
|
4
3
|
import { Navigator } from './Navigator';
|
|
5
4
|
export interface NavigationProps {
|
|
6
5
|
navigator: Navigator;
|
|
7
|
-
garden: Garden;
|
|
8
6
|
sceneId: string;
|
|
9
7
|
}
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated Use NavigationProps instead.
|
|
12
|
-
*/
|
|
13
|
-
export type InjectedProps = NavigationProps;
|
|
14
8
|
interface NativeProps {
|
|
15
9
|
sceneId: string;
|
|
16
10
|
}
|
|
@@ -12,7 +12,6 @@ export function withNavigation(moduleName) {
|
|
|
12
12
|
if (navigator.moduleName === undefined) {
|
|
13
13
|
navigator.moduleName = moduleName;
|
|
14
14
|
}
|
|
15
|
-
const garden = navigator.garden;
|
|
16
15
|
useEffect(() => {
|
|
17
16
|
Navigation.signalFirstRenderComplete(navigator.sceneId);
|
|
18
17
|
return () => {
|
|
@@ -20,7 +19,6 @@ export function withNavigation(moduleName) {
|
|
|
20
19
|
};
|
|
21
20
|
}, [navigator]);
|
|
22
21
|
const injected = {
|
|
23
|
-
garden,
|
|
24
22
|
navigator,
|
|
25
23
|
};
|
|
26
24
|
return (<NavigationContext.Provider value={navigator}>
|
package/lib/Navigator.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { Visibility, Layout, BuildInLayout
|
|
2
|
+
import type { Visibility, Layout, BuildInLayout } from './Route';
|
|
3
3
|
import type { NavigationItem } from './Options';
|
|
4
|
-
import {
|
|
5
|
-
import { NavigationInterceptor, DispatchParams, ResultType } from './Navigation';
|
|
4
|
+
import { ResultType } from './Navigation';
|
|
6
5
|
export declare const NavigationContext: import("react").Context<any>;
|
|
7
6
|
interface NavigationState {
|
|
8
7
|
params: {
|
|
@@ -20,47 +19,7 @@ export declare class Navigator implements Navigator {
|
|
|
20
19
|
static of(sceneId: string): Navigator;
|
|
21
20
|
static find(moduleName: string): Promise<Navigator | undefined>;
|
|
22
21
|
static current(): Promise<Navigator>;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Use Navigation.currentRoute() instead
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
static currentRoute(): Promise<Route>;
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Use Navigation.routeGraph() instead
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
static routeGraph(): Promise<RouteGraph[]>;
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated Use Navigation.setRoot() instead
|
|
35
|
-
* @param layout
|
|
36
|
-
* @param sticky
|
|
37
|
-
*/
|
|
38
|
-
static setRoot(layout: BuildInLayout | Layout, sticky?: boolean): void;
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated Use Navigation.setRootLayoutUpdateListener() instead
|
|
41
|
-
* @param willSetRoot
|
|
42
|
-
* @param didSetRoot
|
|
43
|
-
*/
|
|
44
|
-
static setRootLayoutUpdateListener(willSetRoot?: () => void, didSetRoot?: () => void): void;
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated Use Navigation.dispatch() instead
|
|
47
|
-
* @param sceneId
|
|
48
|
-
* @param action
|
|
49
|
-
* @param params
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
static dispatch(sceneId: string, action: string, params?: DispatchParams): Promise<boolean>;
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated Use Navigation.setInterceptor() instead
|
|
55
|
-
* @param interceptor
|
|
56
|
-
*/
|
|
57
|
-
static setInterceptor(interceptor: NavigationInterceptor): void;
|
|
58
22
|
constructor(sceneId: string, moduleName?: string | undefined);
|
|
59
|
-
private _garden?;
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated Garden is deprecated, Use Navigation related methods instead.
|
|
62
|
-
*/
|
|
63
|
-
get garden(): Garden;
|
|
64
23
|
visibility: Visibility;
|
|
65
24
|
readonly state: NavigationState;
|
|
66
25
|
setParams: (params: {
|
package/lib/Navigator.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
import store from './store';
|
|
3
|
-
import {
|
|
4
|
-
import Navigation, { RESULT_CANCEL, } from './Navigation';
|
|
3
|
+
import Navigation, { RESULT_CANCEL } from './Navigation';
|
|
5
4
|
export const NavigationContext = createContext(null);
|
|
6
5
|
let tagGenerator = 0;
|
|
7
6
|
Navigation.addGlobalVisibilityEventListener((sceneId, visibility) => {
|
|
@@ -35,67 +34,10 @@ export class Navigator {
|
|
|
35
34
|
const route = await Navigation.currentRoute();
|
|
36
35
|
return Navigator.of(route.sceneId);
|
|
37
36
|
}
|
|
38
|
-
/**
|
|
39
|
-
* @deprecated Use Navigation.currentRoute() instead
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
static currentRoute() {
|
|
43
|
-
return Navigation.currentRoute();
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated Use Navigation.routeGraph() instead
|
|
47
|
-
* @returns
|
|
48
|
-
*/
|
|
49
|
-
static routeGraph() {
|
|
50
|
-
return Navigation.routeGraph();
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* @deprecated Use Navigation.setRoot() instead
|
|
54
|
-
* @param layout
|
|
55
|
-
* @param sticky
|
|
56
|
-
*/
|
|
57
|
-
static setRoot(layout, sticky = false) {
|
|
58
|
-
Navigation.setRoot(layout, sticky);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated Use Navigation.setRootLayoutUpdateListener() instead
|
|
62
|
-
* @param willSetRoot
|
|
63
|
-
* @param didSetRoot
|
|
64
|
-
*/
|
|
65
|
-
static setRootLayoutUpdateListener(willSetRoot = () => { }, didSetRoot = () => { }) {
|
|
66
|
-
Navigation.setRootLayoutUpdateListener(willSetRoot, didSetRoot);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated Use Navigation.dispatch() instead
|
|
70
|
-
* @param sceneId
|
|
71
|
-
* @param action
|
|
72
|
-
* @param params
|
|
73
|
-
* @returns
|
|
74
|
-
*/
|
|
75
|
-
static async dispatch(sceneId, action, params = {}) {
|
|
76
|
-
return Navigation.dispatch(sceneId, action, params);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated Use Navigation.setInterceptor() instead
|
|
80
|
-
* @param interceptor
|
|
81
|
-
*/
|
|
82
|
-
static setInterceptor(interceptor) {
|
|
83
|
-
Navigation.setInterceptor(interceptor);
|
|
84
|
-
}
|
|
85
37
|
constructor(sceneId, moduleName) {
|
|
86
38
|
this.sceneId = sceneId;
|
|
87
39
|
this.moduleName = moduleName;
|
|
88
40
|
}
|
|
89
|
-
_garden;
|
|
90
|
-
/**
|
|
91
|
-
* @deprecated Garden is deprecated, Use Navigation related methods instead.
|
|
92
|
-
*/
|
|
93
|
-
get garden() {
|
|
94
|
-
if (!this._garden) {
|
|
95
|
-
this._garden = new Garden(this.sceneId);
|
|
96
|
-
}
|
|
97
|
-
return this._garden;
|
|
98
|
-
}
|
|
99
41
|
visibility = 'pending';
|
|
100
42
|
state = {
|
|
101
43
|
params: {},
|
package/lib/hooks.d.ts
CHANGED
|
@@ -4,8 +4,3 @@ export declare function useNavigator(): Navigator;
|
|
|
4
4
|
export declare function useVisibility(): "visible" | "invisible" | "pending";
|
|
5
5
|
export declare function useVisible(): boolean;
|
|
6
6
|
export declare function useVisibleEffect(effect: React.EffectCallback): void;
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Use Navigation related methods instead.
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
export declare function useGarden(): import("./Garden").Garden;
|
package/lib/hooks.js
CHANGED
|
@@ -28,11 +28,3 @@ export function useVisibleEffect(effect) {
|
|
|
28
28
|
return () => destructor && destructor();
|
|
29
29
|
}, [effect, visible]);
|
|
30
30
|
}
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated Use Navigation related methods instead.
|
|
33
|
-
* @returns
|
|
34
|
-
*/
|
|
35
|
-
export function useGarden() {
|
|
36
|
-
const ctx = useContext(NavigationContext);
|
|
37
|
-
return ctx.garden;
|
|
38
|
-
}
|
package/lib/index.d.ts
CHANGED
|
@@ -3,10 +3,8 @@ export default Navigation;
|
|
|
3
3
|
export { RESULT_OK, RESULT_CANCEL } from './Navigation';
|
|
4
4
|
export { statusBarHeight, toolbarHeight, topBarHeight } from './GardenModule';
|
|
5
5
|
export { withNavigationItem } from './NavigationComponentWrap';
|
|
6
|
-
export type { NavigationProps
|
|
6
|
+
export type { NavigationProps } from './NavigationComponentWrap';
|
|
7
7
|
export * from './Navigator';
|
|
8
|
-
export * from './Garden';
|
|
9
|
-
export * from './ReactRegistry';
|
|
10
8
|
export * from './hooks';
|
|
11
9
|
export * from './router';
|
|
12
10
|
export * from './DeepLink';
|
package/lib/index.js
CHANGED
|
@@ -7,8 +7,6 @@ export { RESULT_OK, RESULT_CANCEL } from './Navigation';
|
|
|
7
7
|
export { statusBarHeight, toolbarHeight, topBarHeight } from './GardenModule';
|
|
8
8
|
export { withNavigationItem } from './NavigationComponentWrap';
|
|
9
9
|
export * from './Navigator';
|
|
10
|
-
export * from './Garden';
|
|
11
|
-
export * from './ReactRegistry';
|
|
12
10
|
export * from './hooks';
|
|
13
11
|
export * from './router';
|
|
14
12
|
export * from './DeepLink';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hybrid-navigation",
|
|
3
3
|
"description": "React Native Navigation that supports seamless navigation between Native and React.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.17.1",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
7
7
|
"react-native": "src/index",
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import React, { useEffect } from 'react'
|
|
2
|
-
import type { Garden } from './Garden'
|
|
3
2
|
import type { NavigationItem } from './Options'
|
|
4
3
|
import { Navigator, NavigationContext } from './Navigator'
|
|
5
4
|
import Navigation from './Navigation'
|
|
6
5
|
|
|
7
6
|
export interface NavigationProps {
|
|
8
7
|
navigator: Navigator
|
|
9
|
-
garden: Garden
|
|
10
8
|
sceneId: string
|
|
11
9
|
}
|
|
12
10
|
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Use NavigationProps instead.
|
|
15
|
-
*/
|
|
16
|
-
export type InjectedProps = NavigationProps
|
|
17
|
-
|
|
18
11
|
interface NativeProps {
|
|
19
12
|
sceneId: string
|
|
20
13
|
}
|
|
@@ -33,8 +26,6 @@ export function withNavigation(moduleName: string) {
|
|
|
33
26
|
navigator.moduleName = moduleName
|
|
34
27
|
}
|
|
35
28
|
|
|
36
|
-
const garden = navigator.garden
|
|
37
|
-
|
|
38
29
|
useEffect(() => {
|
|
39
30
|
Navigation.signalFirstRenderComplete(navigator.sceneId)
|
|
40
31
|
return () => {
|
|
@@ -43,7 +34,6 @@ export function withNavigation(moduleName: string) {
|
|
|
43
34
|
}, [navigator])
|
|
44
35
|
|
|
45
36
|
const injected = {
|
|
46
|
-
garden,
|
|
47
37
|
navigator,
|
|
48
38
|
}
|
|
49
39
|
|
package/src/Navigator.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { createContext } from 'react'
|
|
2
2
|
|
|
3
3
|
import store from './store'
|
|
4
|
-
import type { Visibility, Layout, BuildInLayout
|
|
4
|
+
import type { Visibility, Layout, BuildInLayout } from './Route'
|
|
5
5
|
import type { NavigationItem } from './Options'
|
|
6
|
-
import {
|
|
7
|
-
import Navigation, {
|
|
8
|
-
NavigationInterceptor,
|
|
9
|
-
DispatchParams,
|
|
10
|
-
ResultType,
|
|
11
|
-
RESULT_CANCEL,
|
|
12
|
-
} from './Navigation'
|
|
6
|
+
import Navigation, { ResultType, RESULT_CANCEL } from './Navigation'
|
|
13
7
|
|
|
14
8
|
export const NavigationContext = createContext<any>(null)
|
|
15
9
|
|
|
@@ -59,77 +53,8 @@ export class Navigator implements Navigator {
|
|
|
59
53
|
return Navigator.of(route.sceneId)
|
|
60
54
|
}
|
|
61
55
|
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated Use Navigation.currentRoute() instead
|
|
64
|
-
* @returns
|
|
65
|
-
*/
|
|
66
|
-
static currentRoute(): Promise<Route> {
|
|
67
|
-
return Navigation.currentRoute()
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @deprecated Use Navigation.routeGraph() instead
|
|
72
|
-
* @returns
|
|
73
|
-
*/
|
|
74
|
-
static routeGraph(): Promise<RouteGraph[]> {
|
|
75
|
-
return Navigation.routeGraph()
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated Use Navigation.setRoot() instead
|
|
80
|
-
* @param layout
|
|
81
|
-
* @param sticky
|
|
82
|
-
*/
|
|
83
|
-
static setRoot(layout: BuildInLayout | Layout, sticky = false) {
|
|
84
|
-
Navigation.setRoot(layout, sticky)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* @deprecated Use Navigation.setRootLayoutUpdateListener() instead
|
|
89
|
-
* @param willSetRoot
|
|
90
|
-
* @param didSetRoot
|
|
91
|
-
*/
|
|
92
|
-
static setRootLayoutUpdateListener(willSetRoot = () => {}, didSetRoot = () => {}) {
|
|
93
|
-
Navigation.setRootLayoutUpdateListener(willSetRoot, didSetRoot)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* @deprecated Use Navigation.dispatch() instead
|
|
98
|
-
* @param sceneId
|
|
99
|
-
* @param action
|
|
100
|
-
* @param params
|
|
101
|
-
* @returns
|
|
102
|
-
*/
|
|
103
|
-
static async dispatch(
|
|
104
|
-
sceneId: string,
|
|
105
|
-
action: string,
|
|
106
|
-
params: DispatchParams = {},
|
|
107
|
-
): Promise<boolean> {
|
|
108
|
-
return Navigation.dispatch(sceneId, action, params)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* @deprecated Use Navigation.setInterceptor() instead
|
|
113
|
-
* @param interceptor
|
|
114
|
-
*/
|
|
115
|
-
static setInterceptor(interceptor: NavigationInterceptor) {
|
|
116
|
-
Navigation.setInterceptor(interceptor)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
56
|
constructor(public sceneId: string, public moduleName?: string) {}
|
|
120
57
|
|
|
121
|
-
private _garden?: Garden
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* @deprecated Garden is deprecated, Use Navigation related methods instead.
|
|
125
|
-
*/
|
|
126
|
-
get garden() {
|
|
127
|
-
if (!this._garden) {
|
|
128
|
-
this._garden = new Garden(this.sceneId)
|
|
129
|
-
}
|
|
130
|
-
return this._garden
|
|
131
|
-
}
|
|
132
|
-
|
|
133
58
|
visibility: Visibility = 'pending'
|
|
134
59
|
|
|
135
60
|
readonly state: NavigationState = {
|
package/src/hooks.ts
CHANGED
|
@@ -33,12 +33,3 @@ export function useVisibleEffect(effect: React.EffectCallback) {
|
|
|
33
33
|
return () => destructor && destructor()
|
|
34
34
|
}, [effect, visible])
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated Use Navigation related methods instead.
|
|
39
|
-
* @returns
|
|
40
|
-
*/
|
|
41
|
-
export function useGarden() {
|
|
42
|
-
const ctx = useContext<Navigator>(NavigationContext)
|
|
43
|
-
return ctx.garden
|
|
44
|
-
}
|
package/src/index.ts
CHANGED
|
@@ -6,11 +6,9 @@ export default Navigation
|
|
|
6
6
|
export { RESULT_OK, RESULT_CANCEL } from './Navigation'
|
|
7
7
|
export { statusBarHeight, toolbarHeight, topBarHeight } from './GardenModule'
|
|
8
8
|
export { withNavigationItem } from './NavigationComponentWrap'
|
|
9
|
-
export type { NavigationProps
|
|
9
|
+
export type { NavigationProps } from './NavigationComponentWrap'
|
|
10
10
|
|
|
11
11
|
export * from './Navigator'
|
|
12
|
-
export * from './Garden'
|
|
13
|
-
export * from './ReactRegistry'
|
|
14
12
|
export * from './hooks'
|
|
15
13
|
export * from './router'
|
|
16
14
|
export * from './DeepLink'
|
package/lib/Garden.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { BarButtonItem, DefaultOptions, NavigationOption, TabBarStyle, TabItemInfo, TitleItem } from './Options';
|
|
2
|
-
type Nullable<T> = {
|
|
3
|
-
[P in keyof T]: T[P] extends T[P] | undefined ? T[P] | null : T[P];
|
|
4
|
-
};
|
|
5
|
-
export interface Garden {
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated use Navigation instead. import Navigation from 'hybrid-navigation'
|
|
9
|
-
*/
|
|
10
|
-
export declare class Garden implements Garden {
|
|
11
|
-
sceneId: string;
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Use Navigation.setDefaultOptions() instead.
|
|
14
|
-
* @param style
|
|
15
|
-
*/
|
|
16
|
-
static setStyle(style: DefaultOptions): void;
|
|
17
|
-
constructor(sceneId: string);
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated Use Navigation.setLeftBarButtonItem() instead.
|
|
20
|
-
* @param buttonItem
|
|
21
|
-
*/
|
|
22
|
-
setLeftBarButtonItem(buttonItem: Nullable<BarButtonItem> | null): void;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Use Navigation.setRightBarButtonItem() instead.
|
|
25
|
-
* @param buttonItem
|
|
26
|
-
*/
|
|
27
|
-
setRightBarButtonItem(buttonItem: Nullable<BarButtonItem> | null): void;
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @deprecated Use Navigation.setLeftBarButtonItems() instead.
|
|
31
|
-
* @param buttonItems
|
|
32
|
-
*/
|
|
33
|
-
setLeftBarButtonItems(buttonItems: Array<Nullable<BarButtonItem>> | null): void;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated Use Navigation.setRightBarButtonItems() instead.
|
|
36
|
-
* @param buttonItems
|
|
37
|
-
*/
|
|
38
|
-
setRightBarButtonItems(buttonItems: Array<Nullable<BarButtonItem>> | null): void;
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated Use Navigation.setTitleItem() instead.
|
|
41
|
-
* @param titleItem
|
|
42
|
-
*/
|
|
43
|
-
setTitleItem(titleItem: TitleItem): void;
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated Use Navigation.updateOptions() instead.
|
|
46
|
-
* @param options
|
|
47
|
-
*/
|
|
48
|
-
updateOptions(options: NavigationOption): void;
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated Use Navigation.updateTabBar() instead.
|
|
51
|
-
* @param options
|
|
52
|
-
*/
|
|
53
|
-
updateTabBar(options: TabBarStyle): void;
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated Use Navigation.setTabItem() instead.
|
|
56
|
-
* @param item
|
|
57
|
-
*/
|
|
58
|
-
setTabItem(item: TabItemInfo | TabItemInfo[]): void;
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated Use Navigation.setMenuInteractive() instead.
|
|
61
|
-
* @param enabled
|
|
62
|
-
*/
|
|
63
|
-
setMenuInteractive(enabled: boolean): void;
|
|
64
|
-
}
|
|
65
|
-
export {};
|
package/lib/Garden.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import Navigation from './Navigation';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated use Navigation instead. import Navigation from 'hybrid-navigation'
|
|
4
|
-
*/
|
|
5
|
-
export class Garden {
|
|
6
|
-
sceneId;
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Use Navigation.setDefaultOptions() instead.
|
|
9
|
-
* @param style
|
|
10
|
-
*/
|
|
11
|
-
static setStyle(style) {
|
|
12
|
-
Navigation.setDefaultOptions(style);
|
|
13
|
-
}
|
|
14
|
-
constructor(sceneId) {
|
|
15
|
-
this.sceneId = sceneId;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Use Navigation.setLeftBarButtonItem() instead.
|
|
19
|
-
* @param buttonItem
|
|
20
|
-
*/
|
|
21
|
-
setLeftBarButtonItem(buttonItem) {
|
|
22
|
-
Navigation.setLeftBarButtonItem(this.sceneId, buttonItem);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Use Navigation.setRightBarButtonItem() instead.
|
|
26
|
-
* @param buttonItem
|
|
27
|
-
*/
|
|
28
|
-
setRightBarButtonItem(buttonItem) {
|
|
29
|
-
Navigation.setRightBarButtonItem(this.sceneId, buttonItem);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
* @deprecated Use Navigation.setLeftBarButtonItems() instead.
|
|
34
|
-
* @param buttonItems
|
|
35
|
-
*/
|
|
36
|
-
setLeftBarButtonItems(buttonItems) {
|
|
37
|
-
Navigation.setLeftBarButtonItems(this.sceneId, buttonItems);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated Use Navigation.setRightBarButtonItems() instead.
|
|
41
|
-
* @param buttonItems
|
|
42
|
-
*/
|
|
43
|
-
setRightBarButtonItems(buttonItems) {
|
|
44
|
-
Navigation.setRightBarButtonItems(this.sceneId, buttonItems);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* @deprecated Use Navigation.setTitleItem() instead.
|
|
48
|
-
* @param titleItem
|
|
49
|
-
*/
|
|
50
|
-
setTitleItem(titleItem) {
|
|
51
|
-
Navigation.setTitleItem(this.sceneId, titleItem);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated Use Navigation.updateOptions() instead.
|
|
55
|
-
* @param options
|
|
56
|
-
*/
|
|
57
|
-
updateOptions(options) {
|
|
58
|
-
Navigation.updateOptions(this.sceneId, options);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated Use Navigation.updateTabBar() instead.
|
|
62
|
-
* @param options
|
|
63
|
-
*/
|
|
64
|
-
updateTabBar(options) {
|
|
65
|
-
Navigation.updateTabBar(this.sceneId, options);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* @deprecated Use Navigation.setTabItem() instead.
|
|
69
|
-
* @param item
|
|
70
|
-
*/
|
|
71
|
-
setTabItem(item) {
|
|
72
|
-
Navigation.setTabItem(this.sceneId, item);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated Use Navigation.setMenuInteractive() instead.
|
|
76
|
-
* @param enabled
|
|
77
|
-
*/
|
|
78
|
-
setMenuInteractive(enabled) {
|
|
79
|
-
Navigation.setMenuInteractive(this.sceneId, enabled);
|
|
80
|
-
}
|
|
81
|
-
}
|
package/lib/ReactRegistry.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentProvider } from 'react-native';
|
|
2
|
-
import type { RouteConfig } from './Route';
|
|
3
|
-
import { HOC } from './Navigation';
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated use Navigation instead. import Navigation from 'hybrid-navigation'
|
|
6
|
-
*/
|
|
7
|
-
export declare class ReactRegistry {
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Use Navigation.startRegisterComponent() instead.
|
|
10
|
-
* @param hoc
|
|
11
|
-
*/
|
|
12
|
-
static startRegisterComponent(hoc?: HOC): void;
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Use Navigation.endRegisterComponent() instead.
|
|
15
|
-
*/
|
|
16
|
-
static endRegisterComponent(): void;
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @deprecated Use Navigation.registerComponent() instead.
|
|
20
|
-
* @param appKey
|
|
21
|
-
* @param getComponentFunc
|
|
22
|
-
* @param routeConfig
|
|
23
|
-
*/
|
|
24
|
-
static registerComponent(appKey: string, getComponentFunc: ComponentProvider, routeConfig?: RouteConfig): void;
|
|
25
|
-
}
|
package/lib/ReactRegistry.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import Navigation from './Navigation';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated use Navigation instead. import Navigation from 'hybrid-navigation'
|
|
4
|
-
*/
|
|
5
|
-
export class ReactRegistry {
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Use Navigation.startRegisterComponent() instead.
|
|
8
|
-
* @param hoc
|
|
9
|
-
*/
|
|
10
|
-
static startRegisterComponent(hoc) {
|
|
11
|
-
Navigation.startRegisterComponent(hoc);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Use Navigation.endRegisterComponent() instead.
|
|
15
|
-
*/
|
|
16
|
-
static endRegisterComponent() {
|
|
17
|
-
Navigation.endRegisterComponent();
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @deprecated Use Navigation.registerComponent() instead.
|
|
22
|
-
* @param appKey
|
|
23
|
-
* @param getComponentFunc
|
|
24
|
-
* @param routeConfig
|
|
25
|
-
*/
|
|
26
|
-
static registerComponent(appKey, getComponentFunc, routeConfig) {
|
|
27
|
-
Navigation.registerComponent(appKey, getComponentFunc, routeConfig);
|
|
28
|
-
}
|
|
29
|
-
}
|
package/src/Garden.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import Navigation from './Navigation'
|
|
2
|
-
import type {
|
|
3
|
-
BarButtonItem,
|
|
4
|
-
DefaultOptions,
|
|
5
|
-
NavigationOption,
|
|
6
|
-
TabBarStyle,
|
|
7
|
-
TabItemInfo,
|
|
8
|
-
TitleItem,
|
|
9
|
-
} from './Options'
|
|
10
|
-
|
|
11
|
-
type Nullable<T> = {
|
|
12
|
-
[P in keyof T]: T[P] extends T[P] | undefined ? T[P] | null : T[P]
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface Garden {}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated use Navigation instead. import Navigation from 'hybrid-navigation'
|
|
19
|
-
*/
|
|
20
|
-
export class Garden implements Garden {
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated Use Navigation.setDefaultOptions() instead.
|
|
23
|
-
* @param style
|
|
24
|
-
*/
|
|
25
|
-
static setStyle(style: DefaultOptions) {
|
|
26
|
-
Navigation.setDefaultOptions(style)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
constructor(public sceneId: string) {}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated Use Navigation.setLeftBarButtonItem() instead.
|
|
33
|
-
* @param buttonItem
|
|
34
|
-
*/
|
|
35
|
-
setLeftBarButtonItem(buttonItem: Nullable<BarButtonItem> | null) {
|
|
36
|
-
Navigation.setLeftBarButtonItem(this.sceneId, buttonItem)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated Use Navigation.setRightBarButtonItem() instead.
|
|
41
|
-
* @param buttonItem
|
|
42
|
-
*/
|
|
43
|
-
setRightBarButtonItem(buttonItem: Nullable<BarButtonItem> | null) {
|
|
44
|
-
Navigation.setRightBarButtonItem(this.sceneId, buttonItem)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @deprecated Use Navigation.setLeftBarButtonItems() instead.
|
|
50
|
-
* @param buttonItems
|
|
51
|
-
*/
|
|
52
|
-
setLeftBarButtonItems(buttonItems: Array<Nullable<BarButtonItem>> | null) {
|
|
53
|
-
Navigation.setLeftBarButtonItems(this.sceneId, buttonItems)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated Use Navigation.setRightBarButtonItems() instead.
|
|
58
|
-
* @param buttonItems
|
|
59
|
-
*/
|
|
60
|
-
setRightBarButtonItems(buttonItems: Array<Nullable<BarButtonItem>> | null) {
|
|
61
|
-
Navigation.setRightBarButtonItems(this.sceneId, buttonItems)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @deprecated Use Navigation.setTitleItem() instead.
|
|
66
|
-
* @param titleItem
|
|
67
|
-
*/
|
|
68
|
-
setTitleItem(titleItem: TitleItem) {
|
|
69
|
-
Navigation.setTitleItem(this.sceneId, titleItem)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @deprecated Use Navigation.updateOptions() instead.
|
|
74
|
-
* @param options
|
|
75
|
-
*/
|
|
76
|
-
updateOptions(options: NavigationOption) {
|
|
77
|
-
Navigation.updateOptions(this.sceneId, options)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @deprecated Use Navigation.updateTabBar() instead.
|
|
82
|
-
* @param options
|
|
83
|
-
*/
|
|
84
|
-
updateTabBar(options: TabBarStyle) {
|
|
85
|
-
Navigation.updateTabBar(this.sceneId, options)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @deprecated Use Navigation.setTabItem() instead.
|
|
90
|
-
* @param item
|
|
91
|
-
*/
|
|
92
|
-
setTabItem(item: TabItemInfo | TabItemInfo[]) {
|
|
93
|
-
Navigation.setTabItem(this.sceneId, item)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* @deprecated Use Navigation.setMenuInteractive() instead.
|
|
98
|
-
* @param enabled
|
|
99
|
-
*/
|
|
100
|
-
setMenuInteractive(enabled: boolean) {
|
|
101
|
-
Navigation.setMenuInteractive(this.sceneId, enabled)
|
|
102
|
-
}
|
|
103
|
-
}
|
package/src/ReactRegistry.tsx
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ComponentProvider } from 'react-native'
|
|
2
|
-
import type { RouteConfig } from './Route'
|
|
3
|
-
|
|
4
|
-
import Navigation, { HOC } from './Navigation'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated use Navigation instead. import Navigation from 'hybrid-navigation'
|
|
8
|
-
*/
|
|
9
|
-
export class ReactRegistry {
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated Use Navigation.startRegisterComponent() instead.
|
|
12
|
-
* @param hoc
|
|
13
|
-
*/
|
|
14
|
-
static startRegisterComponent(hoc?: HOC) {
|
|
15
|
-
Navigation.startRegisterComponent(hoc)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated Use Navigation.endRegisterComponent() instead.
|
|
20
|
-
*/
|
|
21
|
-
static endRegisterComponent() {
|
|
22
|
-
Navigation.endRegisterComponent()
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @deprecated Use Navigation.registerComponent() instead.
|
|
28
|
-
* @param appKey
|
|
29
|
-
* @param getComponentFunc
|
|
30
|
-
* @param routeConfig
|
|
31
|
-
*/
|
|
32
|
-
static registerComponent(
|
|
33
|
-
appKey: string,
|
|
34
|
-
getComponentFunc: ComponentProvider,
|
|
35
|
-
routeConfig?: RouteConfig,
|
|
36
|
-
) {
|
|
37
|
-
Navigation.registerComponent(appKey, getComponentFunc, routeConfig)
|
|
38
|
-
}
|
|
39
|
-
}
|