esoftplay 0.0.240 → 0.0.242

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,39 @@ 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
186
  logArgs(params)
182
- this._ref.dispatch(
187
+ this._ref?.dispatch?.(
183
188
  StackActions.replace(replaceModuleByUrlParam(params, route), params)
184
189
  )
185
190
  },
186
191
  /** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/navigation.md#push) untuk melihat dokumentasi*/
187
192
  push<S extends keyof EspArgsInterface>(route: S, params?: EspArgsInterface[S]): void {
188
193
  logArgs(params)
189
- this._ref?.dispatch?.(
190
- StackActions.push(
191
- replaceModuleByUrlParam(params, route),
192
- params
194
+ doIt(() => {
195
+ this._ref?.dispatch?.(
196
+ StackActions.push(
197
+ replaceModuleByUrlParam(params, route),
198
+ params
199
+ )
193
200
  )
194
- )
201
+ })
195
202
  },
196
203
  /** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/navigation.md#reset) untuk melihat dokumentasi*/
197
204
  reset(route?: LibNavigationRoutes, ...routes: LibNavigationRoutes[]): void {
205
+
198
206
  const user = UserClass.state().get()
199
207
  let _route = [route || esp.config('home', (user && (user.id || user.user_id || user.apikey)) ? 'member' : 'public')]
200
208
  if (routes && routes.length > 0) {
201
209
  _route = [..._route, ...routes]
202
210
  }
211
+ // this._ref?.dispatch?.(StackActions.popToTop());
203
212
  const resetAction = CommonActions.reset({
204
213
  index: _route.length - 1,
205
214
  routes: _route.map((rn) => ({ name: rn }))
@@ -210,7 +219,9 @@ export default {
210
219
  back(deep?: number): void {
211
220
  let _deep = deep || 1
212
221
  const popAction = StackActions.pop(_deep);
213
- this._ref?.dispatch?.(popAction)
222
+ doIt(() => {
223
+ this._ref?.dispatch?.(popAction)
224
+ })
214
225
  },
215
226
 
216
227
  /* return `root` on initialRoute otherwise return the route was active */
@@ -233,6 +244,11 @@ export default {
233
244
  }
234
245
  }
235
246
 
247
+ function doIt(func: Function) {
248
+ requestAnimationFrame(() => func())
249
+ }
250
+
251
+
236
252
  function replaceModuleByUrlParam<S extends keyof EspArgsInterface>(params: any, defaultModule: S) {
237
253
  let module = defaultModule
238
254
  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.242",
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",