esoftplay 0.0.122-u → 0.0.122-v
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/bin/router.js +2 -6
- package/modules/lib/navigation.ts +18 -58
- package/package.json +1 -1
package/bin/router.js
CHANGED
|
@@ -71,14 +71,12 @@ import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
|
71
71
|
\nimport { _global } from "esoftplay";\n
|
|
72
72
|
${importer}
|
|
73
73
|
const Stack = createNativeStackNavigator();
|
|
74
|
-
|
|
75
74
|
const config = require('../../../config.json')
|
|
76
75
|
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
|
|
77
76
|
|
|
78
77
|
export default function m(props): any {
|
|
79
78
|
const { user, initialState, handler } = props
|
|
80
79
|
const econf = config.config
|
|
81
|
-
const [s] = LibNavigation.state().useState()
|
|
82
80
|
const appOrientation = econf?.orientation ? String(econf.orientation) : 'portrait'
|
|
83
81
|
return (
|
|
84
82
|
<NavigationContainer
|
|
@@ -723,16 +721,14 @@ function createRouter() {
|
|
|
723
721
|
let screens = []
|
|
724
722
|
|
|
725
723
|
Navigations.forEach((nav) => {
|
|
726
|
-
const prefix = "{(s['" + nav + "'] || __DEV__ ) && "
|
|
727
|
-
const suffix = "}"
|
|
728
724
|
const orientation = NavsOrientation[nav]
|
|
729
725
|
const [module, task] = nav.split('/')
|
|
730
726
|
const comp = ucword(module) + ucword(task)
|
|
731
727
|
importer.push(`import { ${comp} } from ${'"esoftplay/cache/' + module + '/' + task + '/import"'}`)
|
|
732
728
|
if (orientation)
|
|
733
|
-
screens.push("\t\t\t\t" +
|
|
729
|
+
screens.push("\t\t\t\t" + "<Stack.Screen name={\"" + nav + "\"} options={{ orientation: '" + orientation + "' }} component={" + comp + "} />")
|
|
734
730
|
else
|
|
735
|
-
screens.push("\t\t\t\t" +
|
|
731
|
+
screens.push("\t\t\t\t" + "<Stack.Screen name={\"" + nav + "\"} component={" + comp + "} />")
|
|
736
732
|
})
|
|
737
733
|
|
|
738
734
|
let N = Nav5(importer.join("\n"), screens.join("\n"))
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// noPage
|
|
2
2
|
import { CommonActions, StackActions } from '@react-navigation/native';
|
|
3
|
-
import { LibNavigationRoutes
|
|
3
|
+
import { LibNavigationRoutes } from 'esoftplay';
|
|
4
4
|
import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
5
5
|
import { UserRoutes } from 'esoftplay/cache/user/routes/import';
|
|
6
6
|
import esp from 'esoftplay/esp';
|
|
7
|
-
import useGlobalState from 'esoftplay/global';
|
|
8
7
|
import _global from 'esoftplay/_global';
|
|
9
8
|
import React from "react";
|
|
10
9
|
|
|
@@ -13,28 +12,6 @@ export interface LibNavigationInjector {
|
|
|
13
12
|
children?: any
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
const config = require('../../../../config.json')
|
|
17
|
-
|
|
18
|
-
let init = {
|
|
19
|
-
[config.config.home.member]: true,
|
|
20
|
-
[config.config.home.public]: true,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const state = useGlobalState(init)
|
|
24
|
-
function openNav(route: string, fun: Function) {
|
|
25
|
-
state.set(Object.assign({}, state.get(), { [route]: true }))
|
|
26
|
-
const open = () => {
|
|
27
|
-
/* */ setTimeout(() => {
|
|
28
|
-
if (state.get()[route]) {
|
|
29
|
-
/* */ fun()
|
|
30
|
-
} else {
|
|
31
|
-
/* */open()
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
/* */open()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
15
|
export default (() => {
|
|
39
16
|
let libNavigationData: any = {}
|
|
40
17
|
let libNavigationRedirect: any = {}
|
|
@@ -43,10 +20,6 @@ export default (() => {
|
|
|
43
20
|
_global.libNavigationRef = ref
|
|
44
21
|
}
|
|
45
22
|
|
|
46
|
-
static state(): useGlobalReturn<any> {
|
|
47
|
-
return state
|
|
48
|
-
}
|
|
49
|
-
|
|
50
23
|
static setNavigation(nav: any): void {
|
|
51
24
|
libNavigationData._navigation = nav
|
|
52
25
|
}
|
|
@@ -92,9 +65,7 @@ export default (() => {
|
|
|
92
65
|
}
|
|
93
66
|
|
|
94
67
|
static navigate<S>(route: LibNavigationRoutes, params?: S): void {
|
|
95
|
-
|
|
96
|
-
_global.libNavigationRef?.navigate?.(route, params)
|
|
97
|
-
})
|
|
68
|
+
_global.libNavigationRef?.navigate?.(route, params)
|
|
98
69
|
}
|
|
99
70
|
|
|
100
71
|
static getResultKey(props: any): number {
|
|
@@ -121,7 +92,7 @@ export default (() => {
|
|
|
121
92
|
m.back()
|
|
122
93
|
}
|
|
123
94
|
|
|
124
|
-
static navigateForResult<S>(route: LibNavigationRoutes, params?: S, key?: number): Promise<any> {
|
|
95
|
+
static navigateForResult<S>(route: LibNavigationRoutes, params?: S | any, key?: number): Promise<any> {
|
|
125
96
|
if (!key) {
|
|
126
97
|
key = 1
|
|
127
98
|
}
|
|
@@ -130,34 +101,28 @@ export default (() => {
|
|
|
130
101
|
params = {}
|
|
131
102
|
}
|
|
132
103
|
params['_senderKey'] = key
|
|
133
|
-
if (!libNavigationData.hasOwnProperty(key)) {
|
|
104
|
+
if (!libNavigationData.hasOwnProperty(key) && key != undefined) {
|
|
134
105
|
libNavigationData[key] = (value: any) => {
|
|
135
106
|
r(value)
|
|
136
107
|
};
|
|
137
108
|
}
|
|
138
|
-
|
|
139
|
-
m.push(route, params)
|
|
140
|
-
})
|
|
109
|
+
m.push(route, params)
|
|
141
110
|
})
|
|
142
111
|
}
|
|
143
112
|
|
|
144
113
|
static replace<S>(route: LibNavigationRoutes, params?: S): void {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
)
|
|
149
|
-
})
|
|
114
|
+
_global.libNavigationRef.dispatch(
|
|
115
|
+
StackActions.replace(route, params)
|
|
116
|
+
)
|
|
150
117
|
}
|
|
151
118
|
|
|
152
119
|
static push<S>(route: LibNavigationRoutes, params?: S): void {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
params
|
|
158
|
-
)
|
|
120
|
+
_global.libNavigationRef?.dispatch?.(
|
|
121
|
+
StackActions.push(
|
|
122
|
+
route,
|
|
123
|
+
params
|
|
159
124
|
)
|
|
160
|
-
|
|
125
|
+
)
|
|
161
126
|
}
|
|
162
127
|
|
|
163
128
|
static reset(route?: LibNavigationRoutes, ...routes: LibNavigationRoutes[]): void {
|
|
@@ -166,16 +131,11 @@ export default (() => {
|
|
|
166
131
|
if (routes && routes.length > 0) {
|
|
167
132
|
_route = [..._route, ...routes]
|
|
168
133
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
index: _route.length - 1,
|
|
175
|
-
routes: _route.map((rn) => ({ name: rn }))
|
|
176
|
-
});
|
|
177
|
-
_global.libNavigationRef?.dispatch?.(resetAction);
|
|
178
|
-
})
|
|
134
|
+
const resetAction = CommonActions.reset({
|
|
135
|
+
index: _route.length - 1,
|
|
136
|
+
routes: _route.map((rn) => ({ name: rn }))
|
|
137
|
+
});
|
|
138
|
+
_global.libNavigationRef?.dispatch?.(resetAction);
|
|
179
139
|
}
|
|
180
140
|
|
|
181
141
|
static back(deep?: number): void {
|