hybrid-navigation 2.16.0-beta.1 → 2.16.0-beta.3
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/lib/Navigation.d.ts +1 -16
- package/lib/Navigation.js +2 -2
- package/package.json +1 -1
- package/src/Navigation.ts +43 -3
package/lib/Navigation.d.ts
CHANGED
|
@@ -17,30 +17,16 @@ export type NavigationSubscription = {
|
|
|
17
17
|
};
|
|
18
18
|
export type HOC = (WrappedComponent: React.ComponentType<any>) => React.ComponentType<any>;
|
|
19
19
|
export interface Navigation {
|
|
20
|
-
}
|
|
21
|
-
export declare class Navigation implements Navigation {
|
|
22
|
-
private dispatchHandler;
|
|
23
|
-
private resultHandler;
|
|
24
|
-
private buttonHandler;
|
|
25
|
-
private layoutHandler;
|
|
26
|
-
private visibilityHandler;
|
|
27
|
-
constructor();
|
|
28
|
-
private wrap?;
|
|
29
|
-
private hoc?;
|
|
30
|
-
private registerEnded;
|
|
31
20
|
startRegisterComponent(hoc?: HOC): void;
|
|
32
21
|
endRegisterComponent(): void;
|
|
33
22
|
registerComponent(appKey: string, getComponentFunc: ComponentProvider, routeConfig?: RouteConfig): void;
|
|
34
|
-
private _routeConfigs;
|
|
35
|
-
private registerRoute;
|
|
36
23
|
routeConfigs(): Map<string, RouteConfig>;
|
|
37
24
|
setNavigationComponentWrap(wrap: (moduleName: string) => HOC): void;
|
|
38
25
|
addGlobalVisibilityEventListener(listener: GlobalVisibilityEventListener): NavigationSubscription;
|
|
39
26
|
addVisibilityEventListener(sceneId: string, listener: VisibilityEventListener): NavigationSubscription;
|
|
40
27
|
dispatch(sceneId: string, action: string, params?: DispatchParams): Promise<boolean>;
|
|
41
|
-
private handleTabSwitch;
|
|
42
28
|
setInterceptor(interceptor: NavigationInterceptor): void;
|
|
43
|
-
setResult
|
|
29
|
+
setResult<T extends ResultType>(sceneId: string, resultCode: number, data?: T): void;
|
|
44
30
|
result<T extends ResultType>(sceneId: string, resultCode: number): Promise<[number, T]>;
|
|
45
31
|
unmount(sceneId: string): void;
|
|
46
32
|
setRoot(layout: BuildInLayout | Layout, sticky?: boolean): Promise<boolean>;
|
|
@@ -62,7 +48,6 @@ export declare class Navigation implements Navigation {
|
|
|
62
48
|
setTabItem(sceneId: string, item: TabItemInfo | TabItemInfo[]): void;
|
|
63
49
|
setMenuInteractive(sceneId: string, enabled: boolean): void;
|
|
64
50
|
setBarButtonClickEventListener(listener: BarButtonClickEventListener): void;
|
|
65
|
-
private bindBarButtonClickEvent;
|
|
66
51
|
}
|
|
67
52
|
declare const _default: Navigation;
|
|
68
53
|
export default _default;
|
package/lib/Navigation.js
CHANGED
|
@@ -8,7 +8,7 @@ import Event from './Event';
|
|
|
8
8
|
import GardenModule from './GardenModule';
|
|
9
9
|
import NavigationModule from './NavigationModule';
|
|
10
10
|
export const { RESULT_CANCEL, RESULT_OK } = NavigationModule.getConstants();
|
|
11
|
-
|
|
11
|
+
class NavigationImpl {
|
|
12
12
|
dispatchHandler = new DispatchCommandHandler();
|
|
13
13
|
resultHandler = new ResultEventHandler();
|
|
14
14
|
buttonHandler = new BarButtonEventHandler();
|
|
@@ -159,4 +159,4 @@ export class Navigation {
|
|
|
159
159
|
return this.buttonHandler.bindBarButtonClickEvent(sceneId, item);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
export default new
|
|
162
|
+
export default new NavigationImpl();
|
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.16.0-beta.
|
|
4
|
+
"version": "2.16.0-beta.3",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
7
7
|
"react-native": "src/index",
|
package/src/Navigation.ts
CHANGED
|
@@ -42,9 +42,49 @@ export type NavigationSubscription = {
|
|
|
42
42
|
|
|
43
43
|
export type HOC = (WrappedComponent: React.ComponentType<any>) => React.ComponentType<any>
|
|
44
44
|
|
|
45
|
-
export interface Navigation {
|
|
45
|
+
export interface Navigation {
|
|
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(listener: GlobalVisibilityEventListener): NavigationSubscription
|
|
57
|
+
addVisibilityEventListener(
|
|
58
|
+
sceneId: string,
|
|
59
|
+
listener: VisibilityEventListener,
|
|
60
|
+
): NavigationSubscription
|
|
61
|
+
dispatch(sceneId: string, action: string, params?: DispatchParams): Promise<boolean>
|
|
62
|
+
setInterceptor(interceptor: NavigationInterceptor): void
|
|
63
|
+
setResult<T extends ResultType>(sceneId: string, resultCode: number, data?: T): void
|
|
64
|
+
result<T extends ResultType>(sceneId: string, resultCode: number): Promise<[number, T]>
|
|
65
|
+
unmount(sceneId: string): void
|
|
66
|
+
setRoot(layout: BuildInLayout | Layout, sticky?: boolean): Promise<boolean>
|
|
67
|
+
setRootLayoutUpdateListener(willSetRoot?: () => void, didSetRoot?: () => void): void
|
|
68
|
+
currentTab(sceneId: string): Promise<number>
|
|
69
|
+
findSceneIdByModuleName(moduleName: string): Promise<string | null>
|
|
70
|
+
isStackRoot(sceneId: string): Promise<boolean>
|
|
71
|
+
signalFirstRenderComplete(sceneId: string): void
|
|
72
|
+
currentRoute(): Promise<Route>
|
|
73
|
+
routeGraph(): Promise<RouteGraph[]>
|
|
74
|
+
setDefaultOptions(options: DefaultOptions): void
|
|
75
|
+
setLeftBarButtonItem(sceneId: string, buttonItem: Nullable<BarButtonItem> | null): void
|
|
76
|
+
setRightBarButtonItem(sceneId: string, buttonItem: Nullable<BarButtonItem> | null): void
|
|
77
|
+
setLeftBarButtonItems(sceneId: string, buttonItems: Array<Nullable<BarButtonItem>> | null): void
|
|
78
|
+
setRightBarButtonItems(sceneId: string, buttonItems: Array<Nullable<BarButtonItem>> | null): void
|
|
79
|
+
setTitleItem(sceneId: string, titleItem: TitleItem): void
|
|
80
|
+
updateOptions(sceneId: string, options: NavigationOption): void
|
|
81
|
+
updateTabBar(sceneId: string, options: TabBarStyle): void
|
|
82
|
+
setTabItem(sceneId: string, item: TabItemInfo | TabItemInfo[]): void
|
|
83
|
+
setMenuInteractive(sceneId: string, enabled: boolean): void
|
|
84
|
+
setBarButtonClickEventListener(listener: BarButtonClickEventListener): void
|
|
85
|
+
}
|
|
46
86
|
|
|
47
|
-
|
|
87
|
+
class NavigationImpl implements Navigation {
|
|
48
88
|
private dispatchHandler = new DispatchCommandHandler()
|
|
49
89
|
private resultHandler = new ResultEventHandler()
|
|
50
90
|
private buttonHandler = new BarButtonEventHandler()
|
|
@@ -250,4 +290,4 @@ export class Navigation implements Navigation {
|
|
|
250
290
|
}
|
|
251
291
|
}
|
|
252
292
|
|
|
253
|
-
export default new
|
|
293
|
+
export default new NavigationImpl() as Navigation
|