esoftplay 0.0.135-u → 0.0.135-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/global.ts CHANGED
@@ -105,6 +105,7 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
105
105
  clearTimeout(timeoutFinish)
106
106
  timeoutFinish = setTimeout(() => {
107
107
  o.onFinish?.()
108
+ clearTimeout(timeoutFinish)
108
109
  }, 50);
109
110
  }
110
111
  })
@@ -205,7 +205,11 @@ export default class m extends LibComponent<LibCarrouselProps, LibCarrouselState
205
205
  _onLayout(event: any): void {
206
206
  const { height, width } = event.nativeEvent.layout;
207
207
  this.setState({ size: { width, height } });
208
- setTimeout(() => this._placeCritical(this.state.currentPage), 0);
208
+
209
+ const timer = setTimeout(() => {
210
+ this._placeCritical(this.state.currentPage)
211
+ clearTimeout(timer)
212
+ }, 0);
209
213
  }
210
214
 
211
215
  _clearTimer(): void {
@@ -90,8 +90,9 @@ export default function m(props: LibDatepickerProps): any {
90
90
  }
91
91
  setMonths(_months)
92
92
  if (reset) {
93
- setTimeout(() => {
93
+ const timer = setTimeout(() => {
94
94
  refMonth.current!.scrollToIndex(0)
95
+ clearTimeout(timer)
95
96
  }, 200);
96
97
  setMonth(allMonths[0])
97
98
  }
@@ -117,8 +118,9 @@ export default function m(props: LibDatepickerProps): any {
117
118
  }
118
119
  setDates(_dates)
119
120
  if (reset) {
120
- setTimeout(() => {
121
+ const timer = setTimeout(() => {
121
122
  refDate.current!.scrollToIndex(0)
123
+ clearTimeout(timer)
122
124
  }, 200);
123
125
  setDate(_dates[0])
124
126
  }
@@ -104,7 +104,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
104
104
 
105
105
  static fromCamera(options?: LibImageCameraOptions): Promise<string> {
106
106
  return new Promise((_r) => {
107
- setTimeout(async () => {
107
+ const timer = setTimeout(async () => {
108
108
  const cameraPermission = await ImagePicker.getCameraPermissionsAsync();
109
109
  var finalStatus = cameraPermission.status
110
110
  if (finalStatus !== 'granted') {
@@ -144,13 +144,14 @@ class m extends LibComponent<LibImageProps, LibImageState> {
144
144
  }
145
145
  }
146
146
  })
147
+ clearTimeout(timer)
147
148
  }, 1);
148
149
  })
149
150
  }
150
151
 
151
152
  static fromGallery(options?: LibImageGalleryOptions): Promise<string | string[]> {
152
153
  return new Promise((_r) => {
153
- setTimeout(async () => {
154
+ const timer= setTimeout(async () => {
154
155
  const { status } = await ImagePicker.getMediaLibraryPermissionsAsync();
155
156
  var finalStatus = status
156
157
  if (finalStatus !== 'granted') {
@@ -231,6 +232,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
231
232
  }, 1)
232
233
  });
233
234
  })
235
+ clearTimeout(timer)
234
236
  }, 1)
235
237
  })
236
238
  }
@@ -255,7 +257,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
255
257
  }
256
258
  }
257
259
 
258
- setTimeout(async () => {
260
+ const timer= setTimeout(async () => {
259
261
  const manipImage = await ImageManipulator.manipulateAsync(
260
262
  result.uri,
261
263
  doResize ? [{ resize: { width: wantedwidth, height: wantedheight } }] : [],
@@ -270,6 +272,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
270
272
  LibProgress.hide()
271
273
  r(msg.message);
272
274
  }, 1)
275
+ clearTimeout(timer)
273
276
  }, 1);
274
277
  }
275
278
  })
@@ -333,22 +336,24 @@ class m extends LibComponent<LibImageProps, LibImageState> {
333
336
  {
334
337
  image ?
335
338
  <TouchableOpacity onPress={() => {
336
- setTimeout(
339
+ const timer = setTimeout(
337
340
  async () => {
338
341
  let imageUri = await m.processImage(image, maxDimension)
339
342
  m.setResult(imageUri)
340
343
  this.setState({ image: null })
344
+ clearTimeout(timer)
341
345
  });
342
346
  }} >
343
347
  <LibIcon.Ionicons name='ios-checkmark-circle' style={{ fontSize: 40, color: 'white' }} />
344
348
  </TouchableOpacity>
345
349
  :
346
350
  <TouchableOpacity onPress={() => {
347
- setTimeout(
351
+ const timer = setTimeout(
348
352
  async () => {
349
353
  m.hide()
350
354
  this.setState({ image: null })
351
355
  });
356
+ clearTimeout(timer)
352
357
  }} >
353
358
  <LibIcon.Ionicons name='ios-close-circle' style={{ fontSize: 40, color: 'white' }} />
354
359
  </TouchableOpacity>
@@ -179,10 +179,11 @@ export default class m extends LibComponent<LibInputProps, LibInputState>{
179
179
 
180
180
  componentDidMount(): void {
181
181
  super.componentDidMount()
182
- setTimeout(() => {
182
+ const timer = setTimeout(() => {
183
183
  if (this.props.defaultValue) {
184
184
  this.setText(this.props.defaultValue)
185
185
  }
186
+ clearTimeout(timer)
186
187
  });
187
188
  }
188
189
 
@@ -35,8 +35,9 @@ export default function m(props: LibLazyProps): any {
35
35
  InteractionManager.runAfterInteractions(() => {
36
36
  startTransition(() => {
37
37
  item(true)
38
- setTimeout(() => {
38
+ const timer = setTimeout(() => {
39
39
  next()
40
+ clearTimeout(timer)
40
41
  }, 50);
41
42
  })
42
43
  })
@@ -194,13 +194,15 @@ export default {
194
194
  const data = this.getData(notification)
195
195
  function doOpen(data: any) {
196
196
  if (!LibNavigation.getIsReady()) {
197
- setTimeout(() => {
197
+ const timer = setTimeout(() => {
198
198
  doOpen(data)
199
+ clearTimeout(timer)
199
200
  }, 300);
200
201
  return
201
202
  } else {
202
- setTimeout(() => {
203
+ const timer = setTimeout(() => {
203
204
  this.openPushNotif(data)
205
+ clearTimeout(timer)
204
206
  }, 0)
205
207
  }
206
208
  }
@@ -283,19 +285,21 @@ export default {
283
285
  } else {
284
286
  btns.push({ text: "OK", onPress: () => { }, style: "cancel" })
285
287
  }
286
- setTimeout(() => {
288
+ const timer = setTimeout(() => {
287
289
  Alert.alert(
288
290
  param.title,
289
291
  param.message,
290
292
  btns, { cancelable: false }
291
293
  )
294
+ clearTimeout(timer)
292
295
  }, 10)
293
296
  break;
294
297
  case "default":
295
298
  if (param.module && param.module != "") {
296
299
  if (!String(param.module).includes("/")) param.module = param.module + "/index"
297
- setTimeout(() => {
300
+ const timer = setTimeout(() => {
298
301
  LibNavigation.navigate(param.module, param.params)
302
+ clearTimeout(timer)
299
303
  }, 10)
300
304
  }
301
305
  break;
@@ -315,20 +319,22 @@ export default {
315
319
  } else {
316
320
  btns.push({ text: "OK", onPress: () => { }, style: "cancel" })
317
321
  }
318
- setTimeout(() => {
322
+ const timer = setTimeout(() => {
319
323
  Alert.alert(
320
324
  data.title,
321
325
  data.message,
322
326
  btns,
323
327
  { cancelable: false }
324
328
  )
329
+ clearTimeout(timer)
325
330
  }, 10)
326
331
  break;
327
332
  case "default":
328
333
  if (param.module != "") {
329
334
  if (!String(param.module).includes("/")) param.module = param.module + "/index"
330
- setTimeout(() => {
335
+ const timer = setTimeout(() => {
331
336
  LibNavigation.navigate(param.module, param.arguments)
337
+ clearTimeout(timer)
332
338
  }, 10)
333
339
  }
334
340
  break;
@@ -17,7 +17,7 @@ export default function m(props: LibPinProps): any {
17
17
  const input = useRef<TextInput>(null)
18
18
 
19
19
  useEffect(() => {
20
- setTimeout(() => { input?.current?.focus() }, 100);
20
+ const timer = setTimeout(() => { input?.current?.focus() ; clearTimeout(timer)}, 100);
21
21
  setPin(props?.pinValue?.split?.(''))
22
22
  props.onChangePin(props?.pinValue || '')
23
23
  }, [props.pinValue])
@@ -50,8 +50,9 @@ export default class m extends LibComponent<LibScrollpickerProps, LibScrollpicke
50
50
  componentDidMount() {
51
51
  super.componentDidMount()
52
52
  if (this.props.selectedIndex) {
53
- setTimeout(() => {
53
+ const timer = setTimeout(() => {
54
54
  this.scrollToIndex(this.props.selectedIndex);
55
+ clearTimeout(timer)
55
56
  }, 0);
56
57
  }
57
58
  }
@@ -46,8 +46,9 @@ export default class m extends LibComponent<LibSlidingupProps, LibSlidingupState
46
46
  Keyboard.dismiss()
47
47
  if (this.props.children) {
48
48
  this.setState({ show: true }, () => {
49
- setTimeout(() => {
49
+ const timer = setTimeout(() => {
50
50
  this._toggleSubview(true)
51
+ clearTimeout(timer)
51
52
  }, 1);
52
53
  })
53
54
  }
@@ -37,6 +37,7 @@ export function show(message: string, timeout?: number): void {
37
37
  }
38
38
  _timeout = setTimeout(() => {
39
39
  hide()
40
+ clearTimeout(_timeout)
40
41
  }, timeout || initState.timeout);
41
42
  }
42
43
 
@@ -142,11 +142,13 @@ class ewebview extends LibComponent<LibWebviewProps, LibWebviewState> {
142
142
  }}
143
143
  injectedJavaScript={'window.ReactNativeWebView.postMessage(document.body.scrollWidth+"-"+document.body.scrollHeight)'}
144
144
  onLoadEnd={() => {
145
- if (this.props.onFinishLoad !== undefined)
146
- setTimeout(() => {
145
+ if (this.props.onFinishLoad !== undefined){
146
+ const timer = setTimeout(() => {
147
147
  this.setState({ isFinish: true })
148
148
  this.props.onFinishLoad()
149
+ clearTimeout(timer)
149
150
  }, 1000)
151
+ }
150
152
  }}
151
153
  style={[{ width: width, height: this.state.height }, style !== undefined ? style : {}]}
152
154
  scrollEnabled={scrollEnabled !== undefined ? scrollEnabled : false}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.135-u",
3
+ "version": "0.0.135-v",
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",