esoftplay 0.0.147 → 0.0.149
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/cli.js +0 -1
- package/modules/lib/navigation.ts +18 -6
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { CommonActions, StackActions } from '@react-navigation/native';
|
|
4
4
|
import { LibNavigationRoutes } from 'esoftplay';
|
|
5
5
|
import { EspArgsInterface } from 'esoftplay/cache/args';
|
|
6
|
+
import { LibUtils } from 'esoftplay/cache/lib/utils/import';
|
|
6
7
|
import { EspRouterInterface } from 'esoftplay/cache/routers';
|
|
7
8
|
import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
8
9
|
import { UserRoutes } from 'esoftplay/cache/user/routes/import';
|
|
@@ -85,13 +86,13 @@ export default {
|
|
|
85
86
|
/* <T EspRouterInterface>(path: T): EspRouterInterface[T] { */
|
|
86
87
|
/** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/navigation.md#navigate) untuk melihat dokumentasi*/
|
|
87
88
|
navigate<S extends keyof EspArgsInterface>(route: S, params?: EspArgsInterface[S]): void {
|
|
88
|
-
this._ref?.navigate?.(route, params)
|
|
89
|
+
this._ref?.navigate?.(replaceModuleByUrlParam(params, route), params)
|
|
89
90
|
},
|
|
90
91
|
/** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/navigation.md#navigateTab) untuk melihat dokumentasi*/
|
|
91
92
|
navigateTab<S extends keyof EspArgsInterface>(route: S, tabIndex: number, params?: EspArgsInterface[S]): void {
|
|
92
|
-
this._ref?.navigate?.(route, params)
|
|
93
|
+
this._ref?.navigate?.(replaceModuleByUrlParam(params, route), params)
|
|
93
94
|
setTimeout(() => {
|
|
94
|
-
const TabConfig = esp.modProp(route)?.TabConfig;
|
|
95
|
+
const TabConfig = esp.modProp(replaceModuleByUrlParam(params, route))?.TabConfig;
|
|
95
96
|
if (TabConfig) {
|
|
96
97
|
TabConfig.set(esp.mod("lib/object").set(TabConfig.get(), tabIndex)('activeIndex'))
|
|
97
98
|
} else {
|
|
@@ -163,20 +164,20 @@ export default {
|
|
|
163
164
|
r(value)
|
|
164
165
|
};
|
|
165
166
|
}
|
|
166
|
-
this.push(route, params)
|
|
167
|
+
this.push(replaceModuleByUrlParam(params, route), params)
|
|
167
168
|
})
|
|
168
169
|
},
|
|
169
170
|
/** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/navigation.md#replace) untuk melihat dokumentasi*/
|
|
170
171
|
replace<S extends keyof EspArgsInterface>(route: S, params?: EspArgsInterface[S]): void {
|
|
171
172
|
this._ref.dispatch(
|
|
172
|
-
StackActions.replace(route, params)
|
|
173
|
+
StackActions.replace(replaceModuleByUrlParam(params, route), params)
|
|
173
174
|
)
|
|
174
175
|
},
|
|
175
176
|
/** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/navigation.md#push) untuk melihat dokumentasi*/
|
|
176
177
|
push<S extends keyof EspArgsInterface>(route: S, params?: EspArgsInterface[S]): void {
|
|
177
178
|
this._ref?.dispatch?.(
|
|
178
179
|
StackActions.push(
|
|
179
|
-
route,
|
|
180
|
+
replaceModuleByUrlParam(params, route),
|
|
180
181
|
params
|
|
181
182
|
)
|
|
182
183
|
)
|
|
@@ -219,4 +220,15 @@ export default {
|
|
|
219
220
|
if (!props.children) return null
|
|
220
221
|
return React.cloneElement(props.children, { navigation: { state: { params: props.args } } })
|
|
221
222
|
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function replaceModuleByUrlParam<S extends keyof EspArgsInterface>(params: any, defaultModule: S) {
|
|
226
|
+
let module = defaultModule
|
|
227
|
+
if (params?.url) {
|
|
228
|
+
const urlParams = LibUtils.getUrlParams(params.url)
|
|
229
|
+
if (urlParams?.module && urlParams?.url?.includes?.(".")) {
|
|
230
|
+
module = urlParams.module?.replace(/\./g, '/')
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return module
|
|
222
234
|
}
|