esoftplay 0.0.240 → 0.0.241

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.
@@ -93,20 +93,24 @@ export default {
93
93
  /** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/navigation.md#navigate) untuk melihat dokumentasi*/
94
94
  navigate<S extends keyof EspArgsInterface>(route: S, params?: EspArgsInterface[S]): void {
95
95
  logArgs(params)
96
- this._ref?.navigate?.(replaceModuleByUrlParam(params, route), params)
96
+ doIt(() => {
97
+ this._ref?.navigate?.(replaceModuleByUrlParam(params, route), params)
98
+ })
97
99
  },
98
100
  /** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/navigation.md#navigateTab) untuk melihat dokumentasi*/
99
101
  navigateTab<S extends keyof EspArgsInterface>(route: S, tabIndex: number, params?: EspArgsInterface[S]): void {
100
102
  logArgs(params)
101
- this._ref?.navigate?.(replaceModuleByUrlParam(params, route), params)
102
- setTimeout(() => {
103
- const TabConfig = esp.modProp(replaceModuleByUrlParam(params, route))?.TabConfig;
104
- if (TabConfig) {
105
- TabConfig.set(esp.mod("lib/object").set(TabConfig.get(), tabIndex)('activeIndex'))
106
- } else {
107
- console.error("TabConfig not found or exported in module " + route);
108
- }
109
- }, 100);
103
+ doIt(() => {
104
+ this._ref?.navigate?.(replaceModuleByUrlParam(params, route), params)
105
+ setTimeout(() => {
106
+ const TabConfig = esp.modProp(replaceModuleByUrlParam(params, route))?.TabConfig;
107
+ if (TabConfig) {
108
+ TabConfig.set(esp.mod("lib/object").set(TabConfig.get(), tabIndex)('activeIndex'))
109
+ } else {
110
+ console.error("TabConfig not found or exported in module " + route);
111
+ }
112
+ }, 100);
113
+ })
110
114
  },
111
115
  /** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/navigation.md#createTabConfig) untuk melihat dokumentasi*/
112
116
  createTabConfig<S extends keyof EspArgsInterface>(modules: S[], defaultIndex?: number): useGlobalReturn<LibNavigationTabConfigReturn<S>> {
@@ -172,34 +176,41 @@ export default {
172
176
  r(value)
173
177
  };
174
178
  }
175
- logArgs(params)
176
- this.push(replaceModuleByUrlParam(params, route), params)
179
+ doIt(() => {
180
+ this.push(replaceModuleByUrlParam(params, route), params)
181
+ })
177
182
  })
178
183
  },
179
184
  /** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/navigation.md#replace) untuk melihat dokumentasi*/
180
185
  replace<S extends keyof EspArgsInterface>(route: S, params?: EspArgsInterface[S]): void {
181
- logArgs(params)
182
- this._ref.dispatch(
183
- StackActions.replace(replaceModuleByUrlParam(params, route), params)
184
- )
186
+ doIt(() => {
187
+ this._ref.dispatch(
188
+ StackActions.replace(replaceModuleByUrlParam(params, route), params)
189
+ )
190
+ })
185
191
  },
186
192
  /** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/navigation.md#push) untuk melihat dokumentasi*/
187
193
  push<S extends keyof EspArgsInterface>(route: S, params?: EspArgsInterface[S]): void {
188
194
  logArgs(params)
189
- this._ref?.dispatch?.(
190
- StackActions.push(
191
- replaceModuleByUrlParam(params, route),
192
- params
195
+ doIt(() => {
196
+
197
+ this._ref?.dispatch?.(
198
+ StackActions.push(
199
+ replaceModuleByUrlParam(params, route),
200
+ params
201
+ )
193
202
  )
194
- )
203
+ })
195
204
  },
196
205
  /** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/navigation.md#reset) untuk melihat dokumentasi*/
197
206
  reset(route?: LibNavigationRoutes, ...routes: LibNavigationRoutes[]): void {
207
+
198
208
  const user = UserClass.state().get()
199
209
  let _route = [route || esp.config('home', (user && (user.id || user.user_id || user.apikey)) ? 'member' : 'public')]
200
210
  if (routes && routes.length > 0) {
201
211
  _route = [..._route, ...routes]
202
212
  }
213
+ // this._ref?.dispatch?.(StackActions.popToTop());
203
214
  const resetAction = CommonActions.reset({
204
215
  index: _route.length - 1,
205
216
  routes: _route.map((rn) => ({ name: rn }))
@@ -210,7 +221,9 @@ export default {
210
221
  back(deep?: number): void {
211
222
  let _deep = deep || 1
212
223
  const popAction = StackActions.pop(_deep);
213
- this._ref?.dispatch?.(popAction)
224
+ doIt(() => {
225
+ this._ref?.dispatch?.(popAction)
226
+ })
214
227
  },
215
228
 
216
229
  /* return `root` on initialRoute otherwise return the route was active */
@@ -233,6 +246,11 @@ export default {
233
246
  }
234
247
  }
235
248
 
249
+ function doIt(func: Function) {
250
+ requestAnimationFrame(() => func())
251
+ }
252
+
253
+
236
254
  function replaceModuleByUrlParam<S extends keyof EspArgsInterface>(params: any, defaultModule: S) {
237
255
  let module = defaultModule
238
256
  logArgs(params)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.240",
3
+ "version": "0.0.241",
4
4
  "description": "embedding data from esoftplay framework (web based) into mobile app",
5
5
  "main": "cache/index.js",
6
6
  "types": "../../index.d.ts",