hybrid-navigation 2.13.0-beta.2 → 2.13.0

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.
Files changed (80) hide show
  1. package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +3 -20
  2. package/ios/HybridNavigation/HBDUtils.h +3 -6
  3. package/ios/HybridNavigation/HBDUtils.m +10 -0
  4. package/ios/HybridNavigation/Navigator/HBDStackNavigator.m +7 -2
  5. package/ios/HybridNavigation/ReactBridge/HBDNavigationModule.m +1 -1
  6. package/ios/HybridNavigation/View/HBDRootView.m +9 -3
  7. package/ios/HybridNavigation/ViewController/HBDNavigationController.m +0 -30
  8. package/ios/HybridNavigation/ViewController/HBDViewController.m +7 -3
  9. package/ios/HybridNavigation/ViewController/UINavigationController+HBD.m +0 -3
  10. package/lib/Event.d.ts +18 -0
  11. package/lib/Event.js +71 -0
  12. package/lib/Garden.d.ts +46 -68
  13. package/lib/Garden.js +53 -70
  14. package/lib/GardenModule.d.ts +20 -0
  15. package/lib/GardenModule.js +3 -0
  16. package/lib/Navigation.d.ts +74 -0
  17. package/lib/Navigation.js +182 -0
  18. package/lib/NavigationComponentWrap.d.ts +19 -0
  19. package/lib/NavigationComponentWrap.js +46 -0
  20. package/lib/NavigationModule.d.ts +33 -22
  21. package/lib/NavigationModule.js +79 -22
  22. package/lib/Navigator.d.ts +55 -28
  23. package/lib/Navigator.js +122 -263
  24. package/lib/{typing.d.ts → Options.d.ts} +46 -50
  25. package/lib/{typing.js → Options.js} +0 -0
  26. package/lib/ReactRegistry.d.ts +16 -14
  27. package/lib/ReactRegistry.js +18 -93
  28. package/lib/Route.d.ts +74 -0
  29. package/lib/{router/typing.js → Route.js} +0 -0
  30. package/lib/handler/BarButtonEventHandler.d.ts +10 -0
  31. package/lib/handler/BarButtonEventHandler.js +38 -0
  32. package/lib/handler/DispatchCommandHandler.d.ts +24 -0
  33. package/lib/handler/DispatchCommandHandler.js +28 -0
  34. package/lib/handler/LayoutCommandHandler.d.ts +11 -0
  35. package/lib/handler/LayoutCommandHandler.js +39 -0
  36. package/lib/handler/ResultEventHandler.d.ts +15 -0
  37. package/lib/handler/ResultEventHandler.js +47 -0
  38. package/lib/handler/VisibilityEventHandler.d.ts +13 -0
  39. package/lib/handler/VisibilityEventHandler.js +32 -0
  40. package/lib/hooks.d.ts +0 -1
  41. package/lib/hooks.js +14 -29
  42. package/lib/index.d.ts +10 -2
  43. package/lib/index.js +17 -2
  44. package/lib/router/drawer.d.ts +1 -1
  45. package/lib/router/index.d.ts +4 -7
  46. package/lib/router/index.js +13 -6
  47. package/lib/router/screen.d.ts +1 -1
  48. package/lib/router/stack.d.ts +1 -1
  49. package/lib/router/tabs.d.ts +1 -1
  50. package/lib/store.d.ts +0 -9
  51. package/lib/store.js +0 -22
  52. package/package.json +1 -1
  53. package/src/Event.ts +123 -0
  54. package/src/Garden.ts +63 -149
  55. package/src/GardenModule.ts +24 -0
  56. package/src/Navigation.ts +278 -0
  57. package/src/NavigationComponentWrap.tsx +73 -0
  58. package/src/NavigationModule.ts +118 -29
  59. package/src/Navigator.ts +147 -319
  60. package/src/{typing.ts → Options.ts} +51 -57
  61. package/src/ReactRegistry.tsx +25 -127
  62. package/src/Route.ts +88 -0
  63. package/src/handler/BarButtonEventHandler.ts +50 -0
  64. package/src/handler/DispatchCommandHandler.ts +56 -0
  65. package/src/handler/LayoutCommandHandler.ts +49 -0
  66. package/src/handler/ResultEventHandler.ts +67 -0
  67. package/src/handler/VisibilityEventHandler.ts +44 -0
  68. package/src/hooks.ts +13 -38
  69. package/src/index.ts +38 -3
  70. package/src/router/drawer.ts +1 -1
  71. package/src/router/index.ts +36 -12
  72. package/src/router/screen.ts +1 -1
  73. package/src/router/stack.ts +1 -1
  74. package/src/router/tabs.ts +1 -1
  75. package/src/store.ts +0 -28
  76. package/lib/router/typing.d.ts +0 -37
  77. package/lib/utils.d.ts +0 -9
  78. package/lib/utils.js +0 -50
  79. package/src/router/typing.ts +0 -45
  80. package/src/utils.ts +0 -83
package/lib/Navigator.js CHANGED
@@ -1,48 +1,18 @@
1
- import { EventEmitter, NavigationModule, EVENT_WILL_SET_ROOT, EVENT_DID_SET_ROOT, EVENT_SWITCH_TAB, KEY_SCENE_ID, KEY_INDEX, RESULT_CANCEL, EVENT_NAVIGATION, KEY_ON, ON_COMPONENT_RESULT, KEY_REQUEST_CODE, KEY_RESULT_CODE, KEY_RESULT_DATA, } from './NavigationModule';
2
- import { bindBarButtonItemClickEvent } from './utils';
1
+ import { createContext } from 'react';
3
2
  import store from './store';
4
3
  import { Garden } from './Garden';
5
- let interceptor;
6
- let shouldCallWillSetRootCallback = 0;
7
- let willSetRootCallback;
8
- let didSetRootCallback;
9
- let tag = 0;
10
- EventEmitter.addListener(EVENT_DID_SET_ROOT, _ => {
11
- didSetRootCallback && didSetRootCallback();
12
- shouldCallWillSetRootCallback = 0;
13
- });
14
- EventEmitter.addListener(EVENT_WILL_SET_ROOT, _ => {
15
- if (shouldCallWillSetRootCallback === 0 && willSetRootCallback) {
16
- willSetRootCallback();
4
+ import Navigation, { RESULT_CANCEL, } from './Navigation';
5
+ export const NavigationContext = createContext(null);
6
+ let tagGenerator = 0;
7
+ Navigation.addGlobalVisibilityEventListener((sceneId, visibility) => {
8
+ const navigator = store.getNavigator(sceneId);
9
+ if (navigator) {
10
+ navigator.visibility = visibility;
17
11
  }
18
12
  });
19
- EventEmitter.addListener(EVENT_SWITCH_TAB, event => {
20
- const index = event[KEY_INDEX];
21
- const [from, to] = index.split('-');
22
- Navigator.dispatch(event[KEY_SCENE_ID], 'switchTab', {
23
- from: Number(from),
24
- to: Number(to),
25
- });
26
- });
27
- const resultListeners = new Map();
28
- EventEmitter.addListener(EVENT_NAVIGATION, data => {
29
- if (data[KEY_ON] === ON_COMPONENT_RESULT) {
30
- const requestCode = data[KEY_REQUEST_CODE];
31
- const resultCode = data[KEY_RESULT_CODE];
32
- const resultData = data[KEY_RESULT_DATA];
33
- const sceneId = data[KEY_SCENE_ID];
34
- if (requestCode < 0) {
35
- const listener = resultListeners.get(requestCode);
36
- if (listener) {
37
- resultListeners.delete(requestCode);
38
- listener(resultCode, resultData);
39
- }
40
- }
41
- else {
42
- const navigator = Navigator.of(sceneId);
43
- navigator.result(resultCode, resultData);
44
- }
45
- }
13
+ Navigation.setBarButtonClickEventListener((sceneId, value) => {
14
+ const navigator = Navigator.of(sceneId);
15
+ value(navigator);
46
16
  });
47
17
  export class Navigator {
48
18
  sceneId;
@@ -55,17 +25,13 @@ export class Navigator {
55
25
  }
56
26
  return navigator;
57
27
  }
28
+ /**
29
+ * @deprecated Use Navigation.findSceneIdByModuleName() instead.
30
+ * @param moduleName
31
+ * @returns
32
+ */
58
33
  static async find(moduleName) {
59
- const sceneId = await new Promise((resolve, reject) => {
60
- NavigationModule.findSceneIdByModuleName(moduleName, (error, id) => {
61
- if (error) {
62
- reject(error);
63
- }
64
- else {
65
- resolve(id);
66
- }
67
- });
68
- });
34
+ const sceneId = await Navigation.findSceneIdByModuleName(moduleName);
69
35
  if (sceneId) {
70
36
  return Navigator.of(sceneId);
71
37
  }
@@ -74,93 +40,64 @@ export class Navigator {
74
40
  const route = await Navigator.currentRoute();
75
41
  return Navigator.of(route.sceneId);
76
42
  }
43
+ /**
44
+ * @deprecated Use Navigation.currentRoute() instead
45
+ * @returns
46
+ */
77
47
  static currentRoute() {
78
- return new Promise((resolve, reject) => {
79
- NavigationModule.currentRoute((error, route) => {
80
- if (error) {
81
- reject(error);
82
- }
83
- else {
84
- resolve(route);
85
- }
86
- });
87
- });
48
+ return Navigation.currentRoute();
88
49
  }
50
+ /**
51
+ * @deprecated Use Navigation.routeGraph() instead
52
+ * @returns
53
+ */
89
54
  static routeGraph() {
90
- return new Promise((resolve, reject) => {
91
- NavigationModule.routeGraph((error, result) => {
92
- if (error) {
93
- reject(error);
94
- }
95
- else {
96
- resolve(result);
97
- }
98
- });
99
- });
55
+ return Navigation.routeGraph();
100
56
  }
57
+ /**
58
+ * @deprecated Use Navigation.setRoot() instead
59
+ * @param layout
60
+ * @param sticky
61
+ */
101
62
  static setRoot(layout, sticky = false) {
102
- const pureLayout = bindBarButtonItemClickEvent(layout, {
103
- inLayout: true,
104
- navigatorFactory: (sceneId) => {
105
- return Navigator.of(sceneId);
106
- },
107
- });
108
- if (willSetRootCallback) {
109
- shouldCallWillSetRootCallback++;
110
- willSetRootCallback();
111
- }
112
- const flag = --tag;
113
- NavigationModule.setRoot(pureLayout, sticky, flag);
114
- return new Promise(resolve => {
115
- const subscription = EventEmitter.addListener(EVENT_DID_SET_ROOT, (data) => {
116
- if (data.tag === flag) {
117
- subscription.remove();
118
- resolve();
119
- }
120
- });
121
- });
63
+ Navigation.setRoot(layout, sticky);
122
64
  }
65
+ /**
66
+ * @deprecated Use Navigation.setRootLayoutUpdateListener() instead
67
+ * @param willSetRoot
68
+ * @param didSetRoot
69
+ */
123
70
  static setRootLayoutUpdateListener(willSetRoot = () => { }, didSetRoot = () => { }) {
124
- willSetRootCallback = willSetRoot;
125
- didSetRootCallback = didSetRoot;
71
+ Navigation.setRootLayoutUpdateListener(willSetRoot, didSetRoot);
126
72
  }
73
+ /**
74
+ * @deprecated Use Navigation.dispatch() instead
75
+ * @param sceneId
76
+ * @param action
77
+ * @param params
78
+ * @returns
79
+ */
127
80
  static async dispatch(sceneId, action, params = {}) {
128
- let intercepted = false;
129
- const { from, to } = params;
130
- if (interceptor) {
131
- const result = interceptor(action, {
132
- sceneId,
133
- from,
134
- to,
135
- });
136
- if (result instanceof Promise) {
137
- intercepted = await result;
138
- }
139
- else {
140
- intercepted = result;
141
- }
142
- }
143
- if (!intercepted) {
144
- return new Promise((resolve, reject) => {
145
- NavigationModule.dispatch(sceneId, action, params, (error, result) => {
146
- if (error) {
147
- reject(error);
148
- }
149
- else {
150
- resolve(result);
151
- }
152
- });
153
- });
154
- }
155
- return false;
81
+ return Navigation.dispatch(sceneId, action, params);
156
82
  }
157
- static setInterceptor(interceptFn) {
158
- interceptor = interceptFn;
83
+ /**
84
+ * @deprecated Use Navigation.setInterceptor() instead
85
+ * @param interceptor
86
+ */
87
+ static setInterceptor(interceptor) {
88
+ Navigation.setInterceptor(interceptor);
159
89
  }
160
90
  constructor(sceneId, moduleName) {
161
91
  this.sceneId = sceneId;
162
92
  this.moduleName = moduleName;
163
93
  }
94
+ _garden;
95
+ get garden() {
96
+ if (!this._garden) {
97
+ this._garden = new Garden(this.sceneId);
98
+ }
99
+ return this._garden;
100
+ }
164
101
  visibility = 'pending';
165
102
  state = {
166
103
  params: {},
@@ -168,168 +105,90 @@ export class Navigator {
168
105
  setParams = (params) => {
169
106
  this.state.params = { ...this.state.params, ...params };
170
107
  };
171
- dispatch = (action, params = {}) => {
172
- return Navigator.dispatch(this.sceneId, action, {
173
- from: this.moduleName,
174
- to: params.moduleName,
175
- ...params,
176
- });
177
- };
178
- result = (resultCode, data) => {
179
- if (this.resultListener) {
180
- this.resultListener(resultCode, data);
181
- this.resultListener = null;
182
- }
183
- };
184
108
  unmount = () => {
185
- const codes = [];
186
- for (const [requestCode, listener] of resultListeners) {
187
- if (listener.sceneId === this.sceneId) {
188
- codes.push(requestCode);
189
- listener.cancel();
190
- }
191
- }
192
- codes.forEach(code => resultListeners.delete(code));
193
- if (this.resultListener) {
194
- this.resultListener.cancel();
195
- this.resultListener = null;
196
- }
109
+ store.removeNavigator(this.sceneId);
110
+ Navigation.unmount(this.sceneId);
197
111
  };
198
- _garden;
199
- get garden() {
200
- if (!this._garden) {
201
- this._garden = new Garden(this.sceneId);
202
- }
203
- return this._garden;
204
- }
205
- resultListener = null;
206
- waitResult(requestCode, successful) {
207
- if (!successful) {
208
- return Promise.resolve([RESULT_CANCEL, null]);
209
- }
210
- if (this.resultListener) {
211
- this.resultListener.cancel();
212
- this.resultListener = null;
213
- }
214
- return new Promise(resolve => {
215
- const listener = (resultCode, data) => {
216
- resolve([resultCode, data]);
217
- };
218
- listener.cancel = () => {
219
- resolve([RESULT_CANCEL, null]);
220
- };
221
- listener.sceneId = this.sceneId;
222
- if (requestCode < 0) {
223
- resultListeners.set(requestCode, listener);
224
- }
225
- else {
226
- this.resultListener = listener;
227
- }
228
- });
229
- }
230
112
  push = async (moduleName, props = {}, options = {}) => {
231
- const success = await this.dispatch('push', { moduleName, props, options });
232
- console.log('push', success);
233
- return await this.waitResult(0, success);
113
+ const success = await Navigation.dispatch(this.sceneId, 'push', { moduleName, props, options });
114
+ if (!success) {
115
+ return [RESULT_CANCEL, null];
116
+ }
117
+ return await Navigation.result(this.sceneId, 0);
234
118
  };
235
119
  pushLayout = async (layout) => {
236
- const success = await this.dispatch('pushLayout', { layout });
237
- return await this.waitResult(0, success);
238
- };
239
- pop = async () => {
240
- const success = await this.dispatch('pop');
241
- console.log('pop', success);
242
- return success;
243
- };
244
- popTo = (moduleName, inclusive = false) => {
245
- return this.dispatch('popTo', { moduleName, inclusive });
246
- };
247
- popToRoot = () => {
248
- return this.dispatch('popToRoot');
249
- };
250
- redirectTo = async (moduleName, props = {}, options = {}) => {
251
- const success = await this.dispatch('redirectTo', {
252
- moduleName,
253
- props,
254
- options,
255
- });
256
- console.log('redirectTo', success);
257
- return success;
258
- };
259
- isStackRoot = () => {
260
- return new Promise((resolve, reject) => {
261
- NavigationModule.isStackRoot(this.sceneId, (error, result) => {
262
- if (error) {
263
- reject(error);
264
- }
265
- else {
266
- resolve(result);
267
- }
268
- });
269
- });
270
- };
120
+ const success = await Navigation.dispatch(this.sceneId, 'pushLayout', { layout });
121
+ if (!success) {
122
+ return [RESULT_CANCEL, null];
123
+ }
124
+ return await Navigation.result(this.sceneId, 0);
125
+ };
126
+ pop = () => Navigation.dispatch(this.sceneId, 'pop');
127
+ popTo = (moduleName, inclusive = false) => Navigation.dispatch(this.sceneId, 'popTo', { moduleName, inclusive });
128
+ popToRoot = () => Navigation.dispatch(this.sceneId, 'popToRoot');
129
+ redirectTo = (moduleName, props = {}, options = {}) => Navigation.dispatch(this.sceneId, 'redirectTo', {
130
+ moduleName,
131
+ props,
132
+ options,
133
+ });
271
134
  present = async (moduleName, props = {}, options = {}) => {
272
- const requestCode = --tag;
273
- const success = await this.dispatch('present', {
135
+ const requestCode = --tagGenerator;
136
+ const success = await Navigation.dispatch(this.sceneId, 'present', {
274
137
  moduleName,
275
138
  props,
276
139
  options,
277
140
  requestCode,
278
141
  });
279
- return await this.waitResult(requestCode, success);
142
+ if (!success) {
143
+ return [RESULT_CANCEL, null];
144
+ }
145
+ return await Navigation.result(this.sceneId, requestCode);
280
146
  };
281
147
  presentLayout = async (layout) => {
282
- const requestCode = --tag;
283
- const success = await this.dispatch('presentLayout', { layout, requestCode });
284
- return await this.waitResult(requestCode, success);
285
- };
286
- dismiss = () => {
287
- return this.dispatch('dismiss');
148
+ const requestCode = --tagGenerator;
149
+ const success = await Navigation.dispatch(this.sceneId, 'presentLayout', {
150
+ layout,
151
+ requestCode,
152
+ });
153
+ if (!success) {
154
+ return [RESULT_CANCEL, null];
155
+ }
156
+ return await Navigation.result(this.sceneId, requestCode);
288
157
  };
158
+ dismiss = () => Navigation.dispatch(this.sceneId, 'dismiss');
289
159
  showModal = async (moduleName, props = {}, options = {}) => {
290
- const requestCode = --tag;
291
- const success = await this.dispatch('showModal', {
160
+ const requestCode = --tagGenerator;
161
+ const success = await Navigation.dispatch(this.sceneId, 'showModal', {
292
162
  moduleName,
293
163
  props,
294
164
  options,
295
165
  requestCode,
296
166
  });
297
- return await this.waitResult(requestCode, success);
167
+ if (!success) {
168
+ return [RESULT_CANCEL, null];
169
+ }
170
+ return await Navigation.result(this.sceneId, requestCode);
298
171
  };
299
172
  showModalLayout = async (layout) => {
300
- const requestCode = --tag;
301
- const success = await this.dispatch('showModalLayout', { layout, requestCode });
302
- return await this.waitResult(requestCode, success);
303
- };
304
- hideModal = () => {
305
- return this.dispatch('hideModal');
306
- };
307
- setResult = (resultCode, data = null) => {
308
- NavigationModule.setResult(this.sceneId, resultCode, data);
309
- };
310
- switchTab = async (index, popToRoot = false) => {
311
- const from = await new Promise((resolve, reject) => {
312
- NavigationModule.currentTab(this.sceneId, (error, result) => {
313
- if (error) {
314
- reject(error);
315
- }
316
- else {
317
- resolve(result);
318
- }
319
- });
173
+ const requestCode = --tagGenerator;
174
+ const success = await Navigation.dispatch(this.sceneId, 'showModalLayout', {
175
+ layout,
176
+ requestCode,
320
177
  });
321
- return this.dispatch('switchTab', { from, to: index, popToRoot });
322
- };
323
- toggleMenu = () => {
324
- return this.dispatch('toggleMenu');
325
- };
326
- openMenu = () => {
327
- return this.dispatch('openMenu');
328
- };
329
- closeMenu = () => {
330
- return this.dispatch('closeMenu');
331
- };
332
- signalFirstRenderComplete = () => {
333
- NavigationModule.signalFirstRenderComplete(this.sceneId);
178
+ if (!success) {
179
+ return [RESULT_CANCEL, null];
180
+ }
181
+ return await Navigation.result(this.sceneId, requestCode);
334
182
  };
183
+ hideModal = () => Navigation.dispatch(this.sceneId, 'hideModal');
184
+ setResult = (resultCode, data = null) => Navigation.setResult(this.sceneId, resultCode, data);
185
+ switchTab = async (index, popToRoot = false) => {
186
+ const from = await Navigation.currentTab(this.sceneId);
187
+ return Navigation.dispatch(this.sceneId, 'switchTab', { from, to: index, popToRoot });
188
+ };
189
+ toggleMenu = () => Navigation.dispatch(this.sceneId, 'toggleMenu');
190
+ openMenu = () => Navigation.dispatch(this.sceneId, 'openMenu');
191
+ closeMenu = () => Navigation.dispatch(this.sceneId, 'closeMenu');
192
+ isStackRoot = () => Navigation.isStackRoot(this.sceneId);
193
+ signalFirstRenderComplete = () => Navigation.signalFirstRenderComplete(this.sceneId);
335
194
  }
@@ -1,20 +1,5 @@
1
- import { Insets } from 'react-native';
2
- import { Navigator } from './Navigator';
3
- export interface IndexType {
4
- [index: string]: any;
5
- }
6
- export interface PropsType {
7
- [index: string]: any;
8
- }
9
- export declare type ResultType = IndexType | null;
10
- interface Extras {
11
- sceneId: string;
12
- from?: number | string;
13
- to?: number | string;
14
- }
15
- export interface NavigationInterceptor {
16
- (action: string, extras: Extras): boolean | Promise<boolean>;
17
- }
1
+ import type { Insets } from 'react-native';
2
+ import type { Navigator } from './Navigator';
18
3
  export declare type Color = string;
19
4
  export declare type ImageSource = {
20
5
  uri: string;
@@ -93,41 +78,52 @@ export interface TabItem {
93
78
  unselectedIcon?: ImageSource;
94
79
  hideTabBarWhenPush?: boolean;
95
80
  }
96
- export interface Screen extends Layout {
97
- screen: {
98
- moduleName: string;
99
- props?: IndexType;
100
- options?: NavigationItem;
101
- };
81
+ export interface ShadowImage {
82
+ image?: ImageSource;
83
+ color?: Color;
102
84
  }
103
- export interface Stack extends Layout {
104
- stack: {
105
- children: Array<BuildInLayout | Layout>;
106
- options?: {};
107
- };
85
+ export interface DefaultOptions {
86
+ screenBackgroundColor?: Color;
87
+ topBarStyle?: BarStyle;
88
+ topBarColor?: Color;
89
+ topBarColorDarkContent?: Color;
90
+ topBarColorLightContent?: Color;
91
+ statusBarColorAndroid?: Color;
92
+ navigationBarColorAndroid?: Color;
93
+ hideBackTitleIOS?: boolean;
94
+ elevationAndroid?: number;
95
+ shadowImage?: ShadowImage;
96
+ backIcon?: ImageSource;
97
+ topBarTintColor?: Color;
98
+ topBarTintColorDarkContent?: Color;
99
+ topBarTintColorLightContent?: Color;
100
+ titleTextColor?: Color;
101
+ titleTextColorDarkContent?: Color;
102
+ titleTextColorLightContent?: Color;
103
+ titleTextSize?: number;
104
+ titleAlignmentAndroid?: TitleAlignment;
105
+ barButtonItemTextSize?: number;
106
+ swipeBackEnabledAndroid?: boolean;
107
+ splitTopBarTransitionIOS?: boolean;
108
+ scrimAlphaAndroid?: number;
109
+ displayCutoutWhenLandscapeAndroid?: boolean;
110
+ tabBarColor?: Color;
111
+ tabBarShadowImage?: ShadowImage;
112
+ tabBarItemColor?: Color;
113
+ tabBarUnselectedItemColor?: Color;
114
+ tabBarBadgeColor?: Color;
108
115
  }
109
- export interface Tabs extends Layout {
110
- tabs: {
111
- children: Array<BuildInLayout | Layout>;
112
- options?: {
113
- selectedIndex?: number;
114
- tabBarModuleName?: string;
115
- sizeIndeterminate?: boolean;
116
- };
116
+ export declare type TabBarStyle = Pick<DefaultOptions, 'tabBarColor' | 'tabBarShadowImage' | 'tabBarItemColor' | 'tabBarUnselectedItemColor'>;
117
+ export interface TabItemInfo {
118
+ index: number;
119
+ title?: string;
120
+ badge?: {
121
+ text?: string;
122
+ hidden: boolean;
123
+ dot?: boolean;
117
124
  };
118
- }
119
- export interface Drawer extends Layout {
120
- drawer: {
121
- children: [BuildInLayout | Layout, BuildInLayout | Layout];
122
- options?: {
123
- maxDrawerWidth?: number;
124
- minDrawerMargin?: number;
125
- menuInteractive?: boolean;
126
- };
125
+ icon?: {
126
+ selected: ImageSource;
127
+ unselected?: ImageSource;
127
128
  };
128
129
  }
129
- export declare type BuildInLayout = Screen | Stack | Tabs | Drawer;
130
- export interface Layout {
131
- [index: string]: {};
132
- }
133
- export {};
File without changes
@@ -1,20 +1,22 @@
1
1
  import { ComponentProvider } from 'react-native';
2
- import React from 'react';
3
- import { Navigator } from './Navigator';
4
- import { Garden } from './Garden';
5
- import { RouteConfig } from './router';
6
- import { NavigationItem } from './typing';
7
- export interface InjectedProps {
8
- navigator: Navigator;
9
- garden: Garden;
10
- sceneId: string;
11
- }
12
- export declare const NavigationContext: React.Context<any>;
13
- export declare type HOC = (WrappedComponent: React.ComponentType<any>) => React.ComponentType<any>;
2
+ import type { RouteConfig } from './Route';
3
+ import { HOC } from './Navigation';
14
4
  export declare class ReactRegistry {
15
- static registerEnded: boolean;
5
+ /**
6
+ * @deprecated Use Navigation.startRegisterComponent() instead.
7
+ * @param hoc
8
+ */
16
9
  static startRegisterComponent(hoc?: HOC): void;
10
+ /**
11
+ * @deprecated Use Navigation.endRegisterComponent() instead.
12
+ */
17
13
  static endRegisterComponent(): void;
14
+ /**
15
+ *
16
+ * @deprecated Use Navigation.registerComponent() instead.
17
+ * @param appKey
18
+ * @param getComponentFunc
19
+ * @param routeConfig
20
+ */
18
21
  static registerComponent(appKey: string, getComponentFunc: ComponentProvider, routeConfig?: RouteConfig): void;
19
22
  }
20
- export declare function withNavigationItem(item: NavigationItem): (WrappedComponent: React.ComponentType<any>) => React.ComponentType<any>;