hybrid-navigation 2.18.3 → 2.18.4
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/LICENSE +1 -1
- package/{lib → dist}/Navigation.js +3 -2
- package/{lib → dist}/NavigationComponentWrap.js +6 -5
- package/{lib → dist}/Navigator.d.ts +0 -1
- package/{lib → dist}/Navigator.js +15 -4
- package/{lib → dist}/hooks.js +2 -1
- package/{lib → dist}/router/index.js +6 -2
- package/{lib → dist}/router/stack.js +1 -1
- package/ios/HybridNavigation/HBDUtils.h +2 -0
- package/ios/HybridNavigation/HBDUtils.m +12 -3
- package/ios/HybridNavigation/ReactBridge/HBDGardenModule.m +2 -6
- package/ios/HybridNavigation/ReactBridge/HBDNavigationModule.m +11 -12
- package/ios/HybridNavigation/ViewController/HBDDrawerController.m +1 -1
- package/ios/HybridNavigation/ViewController/HBDNavigationController.m +1 -1
- package/ios/HybridNavigation/ViewController/HBDViewController.m +1 -1
- package/package.json +47 -78
- package/src/DeepLink.ts +52 -52
- package/src/Event.ts +88 -83
- package/src/GardenModule.ts +30 -30
- package/src/Navigation.ts +293 -281
- package/src/NavigationComponentWrap.tsx +52 -47
- package/src/NavigationModule.ts +77 -77
- package/src/Navigator.ts +212 -201
- package/src/Options.ts +120 -112
- package/src/Route.ts +59 -59
- package/src/handler/BarButtonEventHandler.ts +50 -46
- package/src/handler/DispatchCommandHandler.ts +56 -52
- package/src/handler/LayoutCommandHandler.ts +21 -21
- package/src/handler/ResultEventHandler.ts +63 -49
- package/src/handler/VisibilityEventHandler.ts +57 -40
- package/src/hooks.ts +23 -21
- package/src/index.ts +15 -15
- package/src/router/drawer.ts +24 -24
- package/src/router/index.ts +206 -198
- package/src/router/screen.ts +28 -28
- package/src/router/stack.ts +76 -76
- package/src/router/tabs.ts +28 -28
- package/src/store.ts +9 -9
- package/README.md +0 -79
- /package/{lib → dist}/DeepLink.d.ts +0 -0
- /package/{lib → dist}/DeepLink.js +0 -0
- /package/{lib → dist}/Event.d.ts +0 -0
- /package/{lib → dist}/Event.js +0 -0
- /package/{lib → dist}/GardenModule.d.ts +0 -0
- /package/{lib → dist}/GardenModule.js +0 -0
- /package/{lib → dist}/Navigation.d.ts +0 -0
- /package/{lib → dist}/NavigationComponentWrap.d.ts +0 -0
- /package/{lib → dist}/NavigationModule.d.ts +0 -0
- /package/{lib → dist}/NavigationModule.js +0 -0
- /package/{lib → dist}/Options.d.ts +0 -0
- /package/{lib → dist}/Options.js +0 -0
- /package/{lib → dist}/Route.d.ts +0 -0
- /package/{lib → dist}/Route.js +0 -0
- /package/{lib → dist}/handler/BarButtonEventHandler.d.ts +0 -0
- /package/{lib → dist}/handler/BarButtonEventHandler.js +0 -0
- /package/{lib → dist}/handler/DispatchCommandHandler.d.ts +0 -0
- /package/{lib → dist}/handler/DispatchCommandHandler.js +0 -0
- /package/{lib → dist}/handler/LayoutCommandHandler.d.ts +0 -0
- /package/{lib → dist}/handler/LayoutCommandHandler.js +0 -0
- /package/{lib → dist}/handler/ResultEventHandler.d.ts +0 -0
- /package/{lib → dist}/handler/ResultEventHandler.js +0 -0
- /package/{lib → dist}/handler/VisibilityEventHandler.d.ts +0 -0
- /package/{lib → dist}/handler/VisibilityEventHandler.js +0 -0
- /package/{lib → dist}/hooks.d.ts +0 -0
- /package/{lib → dist}/index.d.ts +0 -0
- /package/{lib → dist}/index.js +0 -0
- /package/{lib → dist}/router/drawer.d.ts +0 -0
- /package/{lib → dist}/router/drawer.js +0 -0
- /package/{lib → dist}/router/index.d.ts +0 -0
- /package/{lib → dist}/router/screen.d.ts +0 -0
- /package/{lib → dist}/router/screen.js +0 -0
- /package/{lib → dist}/router/stack.d.ts +0 -0
- /package/{lib → dist}/router/tabs.d.ts +0 -0
- /package/{lib → dist}/router/tabs.js +0 -0
- /package/{lib → dist}/store.d.ts +0 -0
- /package/{lib → dist}/store.js +0 -0
package/src/Navigation.ts
CHANGED
|
@@ -1,300 +1,312 @@
|
|
|
1
|
-
import type React from 'react'
|
|
2
|
-
import {
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import {AppRegistry, ComponentProvider} from 'react-native';
|
|
3
3
|
|
|
4
4
|
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from './Options'
|
|
12
|
-
import type {
|
|
13
|
-
|
|
14
|
-
import BarButtonEventHandler from './handler/BarButtonEventHandler'
|
|
15
|
-
import LayoutCommandHandler from './handler/LayoutCommandHandler'
|
|
16
|
-
import DispatchCommandHandler from './handler/DispatchCommandHandler'
|
|
17
|
-
import ResultEventHandler, {
|
|
5
|
+
BarButtonItem,
|
|
6
|
+
DefaultOptions,
|
|
7
|
+
NavigationOption,
|
|
8
|
+
TabBarStyle,
|
|
9
|
+
TabItemInfo,
|
|
10
|
+
TitleItem,
|
|
11
|
+
} from './Options';
|
|
12
|
+
import type {BuildInLayout, Layout, Route, RouteGraph, RouteConfig} from './Route';
|
|
13
|
+
|
|
14
|
+
import BarButtonEventHandler from './handler/BarButtonEventHandler';
|
|
15
|
+
import LayoutCommandHandler from './handler/LayoutCommandHandler';
|
|
16
|
+
import DispatchCommandHandler from './handler/DispatchCommandHandler';
|
|
17
|
+
import ResultEventHandler, {ResultType} from './handler/ResultEventHandler';
|
|
18
18
|
import VisibilityEventHandler, {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from './handler/VisibilityEventHandler'
|
|
19
|
+
GlobalVisibilityEventListener,
|
|
20
|
+
VisibilityEventListener,
|
|
21
|
+
} from './handler/VisibilityEventHandler';
|
|
22
22
|
|
|
23
|
-
import Event from './Event'
|
|
24
|
-
import GardenModule from './GardenModule'
|
|
25
|
-
import NavigationModule from './NavigationModule'
|
|
23
|
+
import Event from './Event';
|
|
24
|
+
import GardenModule from './GardenModule';
|
|
25
|
+
import NavigationModule from './NavigationModule';
|
|
26
26
|
|
|
27
|
-
export type {
|
|
28
|
-
import type {
|
|
29
|
-
export type {
|
|
27
|
+
export type {ResultType} from './handler/ResultEventHandler';
|
|
28
|
+
import type {DispatchParams, NavigationInterceptor} from './handler/DispatchCommandHandler';
|
|
29
|
+
export type {DispatchParams, NavigationInterceptor} from './handler/DispatchCommandHandler';
|
|
30
30
|
|
|
31
|
-
type BarButtonClickEventListener = (sceneId: string, value: Function) => void
|
|
31
|
+
type BarButtonClickEventListener = (sceneId: string, value: Function) => void;
|
|
32
32
|
|
|
33
33
|
type Nullable<T> = {
|
|
34
|
-
|
|
35
|
-
}
|
|
34
|
+
[P in keyof T]: T[P] extends T[P] | undefined ? T[P] | null : T[P];
|
|
35
|
+
};
|
|
36
36
|
|
|
37
|
-
export const {
|
|
37
|
+
export const {RESULT_CANCEL, RESULT_OK, RESULT_BLOCK} = NavigationModule.getConstants();
|
|
38
38
|
|
|
39
39
|
export type NavigationSubscription = {
|
|
40
|
-
|
|
41
|
-
}
|
|
40
|
+
remove: () => void;
|
|
41
|
+
};
|
|
42
42
|
|
|
43
|
-
export type HOC = (WrappedComponent: React.ComponentType<any>) => React.ComponentType<any
|
|
43
|
+
export type HOC = (WrappedComponent: React.ComponentType<any>) => React.ComponentType<any>;
|
|
44
44
|
|
|
45
45
|
export interface Navigation {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
46
|
+
startRegisterComponent(hoc?: HOC): void;
|
|
47
|
+
endRegisterComponent(): void;
|
|
48
|
+
registerComponent(
|
|
49
|
+
appKey: string,
|
|
50
|
+
getComponentFunc: ComponentProvider,
|
|
51
|
+
routeConfig?: RouteConfig,
|
|
52
|
+
): void;
|
|
53
|
+
|
|
54
|
+
routeConfigs(): Map<string, RouteConfig>;
|
|
55
|
+
setNavigationComponentWrap(wrap: (moduleName: string) => HOC): void;
|
|
56
|
+
addGlobalVisibilityEventListener(
|
|
57
|
+
listener: GlobalVisibilityEventListener,
|
|
58
|
+
): NavigationSubscription;
|
|
59
|
+
addVisibilityEventListener(
|
|
60
|
+
sceneId: string,
|
|
61
|
+
listener: VisibilityEventListener,
|
|
62
|
+
): NavigationSubscription;
|
|
63
|
+
dispatch(sceneId: string, action: string, params?: DispatchParams): Promise<boolean>;
|
|
64
|
+
setInterceptor(interceptor: NavigationInterceptor): void;
|
|
65
|
+
setResult<T extends ResultType>(sceneId: string, resultCode: number, data?: T): void;
|
|
66
|
+
result<T extends ResultType>(sceneId: string, resultCode: number): Promise<[number, T]>;
|
|
67
|
+
unmount(sceneId: string): void;
|
|
68
|
+
setRoot(layout: BuildInLayout | Layout, sticky?: boolean): Promise<boolean>;
|
|
69
|
+
setRootLayoutUpdateListener(willSetRoot?: () => void, didSetRoot?: () => void): void;
|
|
70
|
+
currentTab(sceneId: string): Promise<number>;
|
|
71
|
+
findSceneIdByModuleName(moduleName: string): Promise<string | null>;
|
|
72
|
+
isStackRoot(sceneId: string): Promise<boolean>;
|
|
73
|
+
signalFirstRenderComplete(sceneId: string): void;
|
|
74
|
+
currentRoute(): Promise<Route>;
|
|
75
|
+
routeGraph(): Promise<RouteGraph[]>;
|
|
76
|
+
setDefaultOptions(options: DefaultOptions): void;
|
|
77
|
+
setLeftBarButtonItem(sceneId: string, buttonItem: Nullable<BarButtonItem> | null): void;
|
|
78
|
+
setRightBarButtonItem(sceneId: string, buttonItem: Nullable<BarButtonItem> | null): void;
|
|
79
|
+
setLeftBarButtonItems(
|
|
80
|
+
sceneId: string,
|
|
81
|
+
buttonItems: Array<Nullable<BarButtonItem>> | null,
|
|
82
|
+
): void;
|
|
83
|
+
setRightBarButtonItems(
|
|
84
|
+
sceneId: string,
|
|
85
|
+
buttonItems: Array<Nullable<BarButtonItem>> | null,
|
|
86
|
+
): void;
|
|
87
|
+
setTitleItem(sceneId: string, titleItem: TitleItem): void;
|
|
88
|
+
updateOptions(sceneId: string, options: NavigationOption): void;
|
|
89
|
+
updateTabBar(sceneId: string, options: TabBarStyle): void;
|
|
90
|
+
setTabItem(sceneId: string, item: TabItemInfo | TabItemInfo[]): void;
|
|
91
|
+
setMenuInteractive(sceneId: string, enabled: boolean): void;
|
|
92
|
+
setBarButtonClickEventListener(listener: BarButtonClickEventListener): void;
|
|
85
93
|
}
|
|
86
94
|
|
|
87
95
|
class NavigationImpl implements Navigation {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
96
|
+
private dispatchHandler = new DispatchCommandHandler();
|
|
97
|
+
private resultHandler = new ResultEventHandler();
|
|
98
|
+
private buttonHandler = new BarButtonEventHandler();
|
|
99
|
+
private layoutHandler = new LayoutCommandHandler();
|
|
100
|
+
private visibilityHandler = new VisibilityEventHandler();
|
|
101
|
+
|
|
102
|
+
constructor() {
|
|
103
|
+
this.handleTabSwitch();
|
|
104
|
+
this.layoutHandler.handleRootLayoutChange();
|
|
105
|
+
this.visibilityHandler.handleComponentVisibility();
|
|
106
|
+
this.resultHandler.handleComponentResult();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private wrap?: (moduleName: string) => HOC;
|
|
110
|
+
private hoc?: HOC;
|
|
111
|
+
private registerEnded = false;
|
|
112
|
+
|
|
113
|
+
startRegisterComponent(hoc?: HOC) {
|
|
114
|
+
this.hoc = hoc;
|
|
115
|
+
this.registerEnded = false;
|
|
116
|
+
NavigationModule.startRegisterReactComponent();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
endRegisterComponent() {
|
|
120
|
+
if (this.registerEnded) {
|
|
121
|
+
console.warn("Please don't call ReactRegistry#endRegisterComponent multiple times.");
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
this.registerEnded = true;
|
|
125
|
+
NavigationModule.endRegisterReactComponent();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
registerComponent(
|
|
129
|
+
appKey: string,
|
|
130
|
+
getComponentFunc: ComponentProvider,
|
|
131
|
+
routeConfig?: RouteConfig,
|
|
132
|
+
) {
|
|
133
|
+
if (routeConfig) {
|
|
134
|
+
this.registerRoute(appKey, routeConfig);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
let WrappedComponent = getComponentFunc();
|
|
138
|
+
if (this.hoc) {
|
|
139
|
+
WrappedComponent = this.hoc(WrappedComponent);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// build static options
|
|
143
|
+
let options: object =
|
|
144
|
+
this.bindBarButtonClickEvent('permanent', (WrappedComponent as any).navigationItem) ||
|
|
145
|
+
{};
|
|
146
|
+
NavigationModule.registerReactComponent(appKey, options);
|
|
147
|
+
|
|
148
|
+
let RootComponent = this.wrap!(appKey)(WrappedComponent);
|
|
149
|
+
AppRegistry.registerComponent(appKey, () => RootComponent);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
private _routeConfigs = new Map<string, RouteConfig>();
|
|
153
|
+
|
|
154
|
+
private registerRoute(moduleName: string, route: RouteConfig) {
|
|
155
|
+
this._routeConfigs.set(moduleName, route);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
routeConfigs() {
|
|
159
|
+
return this._routeConfigs;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
setNavigationComponentWrap(wrap: (moduleName: string) => HOC) {
|
|
163
|
+
this.wrap = wrap;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
addGlobalVisibilityEventListener(
|
|
167
|
+
listener: GlobalVisibilityEventListener,
|
|
168
|
+
): NavigationSubscription {
|
|
169
|
+
this.visibilityHandler.addGlobalVisibilityEventListener(listener);
|
|
170
|
+
return {
|
|
171
|
+
remove: () => this.visibilityHandler.removeGlobalVisibilityEventListener(listener),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
addVisibilityEventListener(
|
|
176
|
+
sceneId: string,
|
|
177
|
+
listener: VisibilityEventListener,
|
|
178
|
+
): NavigationSubscription {
|
|
179
|
+
this.visibilityHandler.addVisibilityEventListener(sceneId, listener);
|
|
180
|
+
return {
|
|
181
|
+
remove: () => this.visibilityHandler.removeVisibilityEventListener(sceneId, listener),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
dispatch(sceneId: string, action: string, params: DispatchParams = {}) {
|
|
186
|
+
return this.dispatchHandler.dispatch(sceneId, action, params);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private handleTabSwitch() {
|
|
190
|
+
Event.listenTabSwitch((sceneId: string, from: number, to: number) => {
|
|
191
|
+
this.dispatch(sceneId, 'switchTab', {from, to});
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
setInterceptor(interceptor: NavigationInterceptor) {
|
|
196
|
+
this.dispatchHandler.setInterceptor(interceptor);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
setResult = <T extends ResultType>(
|
|
200
|
+
sceneId: string,
|
|
201
|
+
resultCode: number,
|
|
202
|
+
data: T = null as T,
|
|
203
|
+
): void => {
|
|
204
|
+
if (resultCode < RESULT_OK) {
|
|
205
|
+
console.warn(
|
|
206
|
+
'`resultCode` can only be `RESULT_OK`, `RESULT_CANCEL` or an integer greater than 0.',
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
NavigationModule.setResult(sceneId, resultCode, data);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
result<T extends ResultType>(sceneId: string, resultCode: number) {
|
|
213
|
+
return this.resultHandler.waitResult<T>(sceneId, resultCode);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
unmount(sceneId: string) {
|
|
217
|
+
this.resultHandler.invalidateResultEventListener(sceneId);
|
|
218
|
+
this.buttonHandler.unbindBarButtonClickEvent(sceneId);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
setRoot(layout: BuildInLayout | Layout, sticky = false) {
|
|
222
|
+
return this.layoutHandler.setRoot(layout, sticky);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
setRootLayoutUpdateListener(willSetRoot = () => {}, didSetRoot = () => {}) {
|
|
226
|
+
this.layoutHandler.setRootLayoutUpdateListener(willSetRoot, didSetRoot);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
currentTab(sceneId: string) {
|
|
230
|
+
return NavigationModule.currentTab(sceneId);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
findSceneIdByModuleName(moduleName: string) {
|
|
234
|
+
return NavigationModule.findSceneIdByModuleName(moduleName);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
isStackRoot(sceneId: string) {
|
|
238
|
+
return NavigationModule.isStackRoot(sceneId);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
signalFirstRenderComplete(sceneId: string) {
|
|
242
|
+
NavigationModule.signalFirstRenderComplete(sceneId);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
currentRoute(): Promise<Route> {
|
|
246
|
+
return NavigationModule.currentRoute();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
routeGraph(): Promise<RouteGraph[]> {
|
|
250
|
+
return NavigationModule.routeGraph();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
setDefaultOptions(options: DefaultOptions) {
|
|
254
|
+
GardenModule.setStyle(options);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
setLeftBarButtonItem(sceneId: string, buttonItem: Nullable<BarButtonItem> | null) {
|
|
258
|
+
const options = this.bindBarButtonClickEvent(sceneId, buttonItem);
|
|
259
|
+
GardenModule.setLeftBarButtonItem(sceneId, options);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
setRightBarButtonItem(sceneId: string, buttonItem: Nullable<BarButtonItem> | null) {
|
|
263
|
+
const options = this.bindBarButtonClickEvent(sceneId, buttonItem);
|
|
264
|
+
GardenModule.setRightBarButtonItem(sceneId, options);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
setLeftBarButtonItems(sceneId: string, buttonItems: Array<Nullable<BarButtonItem>> | null) {
|
|
268
|
+
const options = this.bindBarButtonClickEvent(sceneId, buttonItems);
|
|
269
|
+
GardenModule.setLeftBarButtonItems(sceneId, options);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
setRightBarButtonItems(sceneId: string, buttonItems: Array<Nullable<BarButtonItem>> | null) {
|
|
273
|
+
const options = this.bindBarButtonClickEvent(sceneId, buttonItems);
|
|
274
|
+
GardenModule.setRightBarButtonItems(sceneId, options);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
setTitleItem(sceneId: string, titleItem: TitleItem) {
|
|
278
|
+
GardenModule.setTitleItem(sceneId, titleItem);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
updateOptions(sceneId: string, options: NavigationOption) {
|
|
282
|
+
GardenModule.updateOptions(sceneId, options);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
updateTabBar(sceneId: string, options: TabBarStyle) {
|
|
286
|
+
GardenModule.updateTabBar(sceneId, options);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
setTabItem(sceneId: string, item: TabItemInfo | TabItemInfo[]) {
|
|
290
|
+
if (!Array.isArray(item)) {
|
|
291
|
+
item = [item];
|
|
292
|
+
}
|
|
293
|
+
GardenModule.setTabItem(sceneId, item);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
setMenuInteractive(sceneId: string, enabled: boolean) {
|
|
297
|
+
GardenModule.setMenuInteractive(sceneId, enabled);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
setBarButtonClickEventListener(listener: BarButtonClickEventListener) {
|
|
301
|
+
this.buttonHandler.setBarButtonClickEventListener(listener);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
private bindBarButtonClickEvent(
|
|
305
|
+
sceneId: string,
|
|
306
|
+
item: object | null | undefined,
|
|
307
|
+
): object | null {
|
|
308
|
+
return this.buttonHandler.bindBarButtonClickEvent(sceneId, item);
|
|
309
|
+
}
|
|
298
310
|
}
|
|
299
311
|
|
|
300
|
-
export default new NavigationImpl() as Navigation
|
|
312
|
+
export default new NavigationImpl() as Navigation;
|