esoftplay 0.0.108 → 0.0.109

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/_cache.ts CHANGED
@@ -33,16 +33,19 @@ export default (() => {
33
33
 
34
34
  function set(ns: T | ((x: T) => T)) {
35
35
  let isChange = false
36
- if (o?.listener && !isEqual(value[_idx], ns)) {
36
+ if (!isEqual(value[_idx], ns)) {
37
37
  isChange = true
38
38
  }
39
- value[_idx] = ns instanceof Function ? ns(value[_idx]) : ns
40
- fastLoop(useCacheSubscriber[_idx], (c: any) => c?.(value[_idx]))
41
- if (o?.persistKey) {
42
- AsyncStorage.setItem(o.persistKey, JSON.stringify(value[_idx]))
39
+ if (isChange) {
40
+ value[_idx] = ns instanceof Function ? ns(value[_idx]) : ns
41
+ fastLoop(useCacheSubscriber[_idx], (c: any) => c?.(value[_idx]))
42
+ if (o?.persistKey) {
43
+ AsyncStorage.setItem(o.persistKey, JSON.stringify(value[_idx]))
44
+ }
45
+ if (o?.listener) {
46
+ o?.listener?.(ns instanceof Function ? ns(value[_idx]) : ns)
47
+ }
43
48
  }
44
- if (isChange)
45
- o.listener(ns instanceof Function ? ns(value[_idx]) : ns)
46
49
  };
47
50
 
48
51
  function del() {
package/bin/build.js CHANGED
@@ -255,26 +255,27 @@ yarn.lock\n\
255
255
  console.log('.gitignore has been created');
256
256
  });
257
257
 
258
- const AppJS = `import React, { useEffect, useRef } from 'react';
259
- import { esp, LibNotification } from 'esoftplay';
260
- import * as ErrorReport from 'esoftplay/error'
261
- import * as Notifications from 'expo-notifications';
262
- import { enableScreens } from 'react-native-screens';
263
- const { globalIdx } = require('esoftplay/global')
264
- enableScreens();
265
-
266
- Notifications.addNotificationResponseReceivedListener(x => LibNotification.onAction(x))
267
-
268
- export default function App() {
269
- const Home = useRef(esp.home()).current
270
-
271
- useEffect(() => {
272
- globalIdx.reset()
273
- ErrorReport.getError()
274
- }, [])
275
-
276
- return <Home />
277
- }`;
258
+ const AppJS = `import { esp, LibNotification } from 'esoftplay';
259
+ import * as ErrorReport from 'esoftplay/error';
260
+ import * as Notifications from 'expo-notifications';
261
+ import React, { useEffect, useRef } from 'react';
262
+ import { enableFreeze, enableScreens } from 'react-native-screens';
263
+ const { globalIdx } = require('esoftplay/global')
264
+ enableScreens();
265
+ enableFreeze(true);
266
+
267
+ Notifications.addNotificationResponseReceivedListener(x => LibNotification.onAction(x))
268
+
269
+ export default function App() {
270
+ const Home = useRef(esp.home()).current
271
+
272
+ useEffect(() => {
273
+ globalIdx.reset()
274
+ ErrorReport.getError()
275
+ }, [])
276
+
277
+ return <Home />
278
+ }`;
278
279
  let expoLib = [
279
280
  '@expo/vector-icons',
280
281
  '@react-native-async-storage/async-storage',
@@ -284,7 +285,9 @@ export default function App() {
284
285
  '@react-navigation/native',
285
286
  '@react-navigation/stack',
286
287
  'buffer',
288
+ 'axios',
287
289
  'expo-av',
290
+ 'expo-application',
288
291
  'expo-blur',
289
292
  'expo-camera',
290
293
  'expo-clipboard',
@@ -298,6 +301,7 @@ export default function App() {
298
301
  'expo-media-library',
299
302
  'expo-notifications',
300
303
  'expo-status-bar',
304
+ 'expo-secure-store',
301
305
  'expo-updates',
302
306
  'firebase',
303
307
  'immhelper',
@@ -360,7 +364,7 @@ export default function App() {
360
364
  /* bugfix AsyncStorage @firebase, remove this section if firebase has update the AsyncStorage */
361
365
  if (fs.existsSync('../@firebase/app/dist/index.rn.cjs.js')) {
362
366
  let firebaseText = fs.readFileSync('../@firebase/app/dist/index.rn.cjs.js', 'utf8')
363
- firebaseText = firebaseText.replace("var AsyncStorage = require('react-native').AsyncStorage;", "var AsyncStorage = require('@react-native-async-storage/async-storage');")
367
+ firebaseText = firebaseText.replace("var AsyncStorage = require('react-native').AsyncStorage;", "var AsyncStorage = require('@react-native-async-storage/async-storage').default;")
364
368
  fs.writeFileSync('../@firebase/app/dist/index.rn.cjs.js', firebaseText)
365
369
  }
366
370
  /* end AsyncStorage @firebase section */
package/esp.ts CHANGED
@@ -112,6 +112,7 @@ export default (() => {
112
112
  const _store: any = LibLocale.state().get()
113
113
  return _store.lang_id
114
114
  }
115
+
115
116
  function mod(path: string): any {
116
117
  var modtast = path.split("/");
117
118
  if (modtast[1] == "") {
@@ -119,35 +120,39 @@ export default (() => {
119
120
  }
120
121
  return routers(modtast.join("/"));
121
122
  }
123
+
122
124
  function _config(): string {
123
125
  var msg = ''
124
126
  if (!app.hasOwnProperty('config')) {
125
- msg = "app.json tidak ada config"
127
+ msg = "tidak ada config"
126
128
  } else if (!app.config.hasOwnProperty('domain') || app.config.domain.length == 0) {
127
- msg = "app.json di config tidak ada domain"
129
+ msg = "config tidak ada domain"
128
130
  } else if (!app.config.hasOwnProperty('salt') || app.config.salt.length == 0) {
129
- msg = "app.json di config tidak ada salt"
131
+ msg = "config tidak ada salt"
130
132
  }
131
133
  if (msg != '') {
132
134
  let error = new Error(msg);
133
135
  throw error;
134
136
  }
135
137
 
136
- var config = app.config;
137
- if (!config.hasOwnProperty('timezone') || config.timezone.length == 0) {
138
- config.timezone = 'Asia/Jakarta';
139
- }
140
- if (!config.hasOwnProperty('protocol') || config.protocol.length == 0) {
141
- config.protocol = 'http';
142
- }
143
- if (!config.hasOwnProperty('uri') || config.uri.length == 0) {
144
- config.uri = "/";
145
- }
146
- if (!config.hasOwnProperty('api') || config.api.length == 0) {
147
- config.api = "api";
148
- }
149
- if (!config.hasOwnProperty('data') || config.data.length == 0) {
150
- config.data = "data";
138
+ var config = {
139
+ // default config
140
+ timezone: "Asia/Jakarta",
141
+ protocol: "http",
142
+ uri: "/",
143
+ api: "api",
144
+ data: "data",
145
+ home: {
146
+ member: "content/index",
147
+ public: "content/index"
148
+ },
149
+ group_id: 0,
150
+ langIds: ["id", "en"],
151
+ theme: ["light", "dark"],
152
+ comment_login: 1,
153
+ notification: 0,
154
+ isDebug: __DEV__ ? 1 : 0,
155
+ ...app.config
151
156
  }
152
157
  if (!config.hasOwnProperty('url') || config.url.length == 0) {
153
158
  config.url = config.protocol + "://" + config.api + "." + config.domain + config.uri;
@@ -155,44 +160,11 @@ export default (() => {
155
160
  if (!config.hasOwnProperty('content') || config.content.length == 0) {
156
161
  config.content = config.protocol + "://" + config.data + "." + config.domain + config.uri;
157
162
  }
158
- if (config.hasOwnProperty('home') && config.home.length != 0) {
159
- if (!config.home.hasOwnProperty('member') || config.home.member.length == 0) {
160
- config.home.member = "content/index";
161
- }
162
- if (!config.home.hasOwnProperty('public') || config.home.public.length == 0) {
163
- config.home.public = "content/index";
164
- }
165
- } else {
166
- config.home = {};
167
- config.home.member = "content/index";
168
- config.home.public = "content/index";
169
- }
170
- if (!config.hasOwnProperty('api') || config.api.length == 0) {
171
- config.api = "api";
172
- }
173
- if (!config.hasOwnProperty('group_id')) {
174
- config.group_id = '0'
175
- }
176
- if (!config.hasOwnProperty('langIds')) {
177
- config.langIds = ["id", "en"];
178
- }
179
- if (!config.hasOwnProperty('theme')) {
180
- config.theme = ['light', 'dark']
181
- }
182
- if (!config.hasOwnProperty('comment_login')) {
183
- config.comment_login = 1;
184
- }
185
- if (!config.hasOwnProperty('notification')) {
186
- config.notification = 0;
187
- }
188
- if (!config.hasOwnProperty("isDebug")) {
189
- config.isDebug = __DEV__ ? 1 : 0;
190
- }
191
-
192
163
  config.webviewOpen = '<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link href="' + config.content + 'user/editor_css" rel="stylesheet" /> <script type="text/javascript">var _ROOT="' + config.uri + '";var _URL="' + config.content + '";function _Bbc(a,b){var c="BS3load_func";if(!window[c+"i"]){window[c+"i"]=0};window[c+"i"]++;if(!b){b=c+"i"+window[c+"i"]};if(!window[c]){window[c]=b}else{window[c]+=","+b}window[b]=a;if(typeof BS3!="undefined"){window[b](BS3)}};</script> <style type="text/css">body {padding: 0 20px;}</style></head> <body>';
193
164
  config.webviewClose = '<script src="' + config.content + 'templates/admin/bootstrap/js/bootstrap.min.js"></script> </body> </html>';
194
165
  return config;
195
166
  }
167
+
196
168
  function navigations(): string[] {
197
169
  return navs;
198
170
  }
package/fast.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const fastFilter = (a: any[], fn: (v: any) => boolean) => {
2
- const f = []; //final
2
+ let f = []; //final
3
3
  const al = a.length - 1
4
4
  for (let i = 0; i <= al; i++) {
5
5
  if (fn(a[i])) {
package/global.ts CHANGED
@@ -65,12 +65,12 @@ const n = () => {
65
65
 
66
66
  function set(ns: T) {
67
67
  const isChange = !isEqual(value, ns)
68
- value = ns
69
- fastLoop(subscriber?.[_idx], (c) => { c?.(ns) })
70
- if (o?.persistKey) {
71
- AsyncStorage.setItem(o.persistKey, JSON.stringify(ns))
72
- }
73
68
  if (isChange) {
69
+ value = ns
70
+ fastLoop(subscriber?.[_idx], (c) => { c?.(ns) })
71
+ if (o?.persistKey) {
72
+ AsyncStorage.setItem(o.persistKey, JSON.stringify(ns))
73
+ }
74
74
  if (o?.listener)
75
75
  o.listener(ns)
76
76
  }
@@ -1,10 +1,13 @@
1
1
  // noPage
2
-
3
2
  import { esp, LibCrypt, LibNet_status, LibProgress, LibUtils } from 'esoftplay';
4
- import { reportApiError } from "../../error";
5
- import moment from "../../moment";
3
+ import { reportApiError } from "esoftplay/error";
4
+ import moment from "esoftplay/moment";
5
+ const axios = require('axios');
6
+
6
7
 
7
8
  export default class ecurl {
9
+ timeout = 55000;
10
+ timeoutContext: any = null;
8
11
  isDebug = esp.config("isDebug");
9
12
  post: any;
10
13
  header: any;
@@ -18,8 +21,8 @@ export default class ecurl {
18
21
  ok: "Coba Lagi",
19
22
  cancel: "Tutup"
20
23
  }
21
- controller = new AbortController();
22
- signal = this.controller.signal;
24
+
25
+ abort = axios.CancelToken.source();
23
26
 
24
27
  constructor(uri?: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number) {
25
28
  this.header = {}
@@ -36,6 +39,8 @@ export default class ecurl {
36
39
  this.onError = this.onError.bind(this)
37
40
  this.setApiKey = this.setApiKey.bind(this)
38
41
  this.secure = this.secure.bind(this)
42
+ this.initTimeout = this.initTimeout.bind(this)
43
+ this.cancelTimeout = this.cancelTimeout.bind(this)
39
44
  const str: any = LibNet_status.state().get()
40
45
  if (uri && str.isOnline) {
41
46
  this.init(uri, post, onDone, onFailed, debug);
@@ -44,6 +49,22 @@ export default class ecurl {
44
49
  }
45
50
  }
46
51
 
52
+ initTimeout(customTimeout?: number): void {
53
+ this.cancelTimeout()
54
+ this.timeoutContext = setTimeout(() => {
55
+ if (this.abort?.cancel) {
56
+ // reportApiError(`Request timeout`, this.url + this.uri)
57
+ this.closeConnection()
58
+ LibProgress.hide()
59
+ }
60
+ }, customTimeout ?? this.timeout);
61
+ }
62
+
63
+ cancelTimeout(): void {
64
+ clearTimeout(this.timeoutContext)
65
+ this.timeoutContext = null;
66
+ }
67
+
47
68
  onFetchFailed(message: string): void {
48
69
 
49
70
  }
@@ -70,7 +91,7 @@ export default class ecurl {
70
91
  }
71
92
 
72
93
  closeConnection(): void {
73
- this?.controller?.abort?.()
94
+ this?.abort?.cancel('Oops, Sepertinya ada gangguan jaringan... Silahkan coba beberapa saat lagi');
74
95
  }
75
96
 
76
97
  onDone(result: any, msg?: string): void {
@@ -105,18 +126,21 @@ export default class ecurl {
105
126
  }
106
127
  let ps = Object.keys(_post).map((key) => encodeURIComponent(key) + '=' + encodeURIComponent(_post[key])).join('&');
107
128
  var options: any = {
108
- signal: this.signal,
129
+ url: this.url + this.uri + (token_uri || 'get_token'),
109
130
  method: "POST",
131
+ cancelToken: this.abort.token,
110
132
  headers: {
111
133
  ...this.header,
112
134
  ["Content-Type"]: "application/x-www-form-urlencoded;charset=UTF-8"
113
135
  },
114
- body: ps,
136
+ data: ps,
115
137
  cache: "no-store",
116
138
  _post: _post
117
139
  }
118
- fetch(this.url + this.uri + (token_uri || 'get_token'), options).then(async (res) => {
119
- let resText = await res.text()
140
+ this.initTimeout();
141
+ axios(options).then(async (res: any) => {
142
+ this.cancelTimeout();
143
+ let resText = res.data;
120
144
  this.onFetched(resText,
121
145
  (res, msg) => {
122
146
  this.init(uri, { ...post, access_token: res }, onDone, onFailed, debug);
@@ -124,11 +148,10 @@ export default class ecurl {
124
148
  if (onFailed)
125
149
  onFailed(msg, false)
126
150
  }, debug)
127
- }).catch((r) => {
151
+ }).catch((r: string) => {
152
+ this.cancelTimeout();
128
153
  LibProgress.hide()
129
154
  this.onFetchFailed(r)
130
- // if (onFailed)
131
- // onFailed(r, true)
132
155
  })
133
156
  }
134
157
  }
@@ -219,13 +242,14 @@ export default class ecurl {
219
242
  }
220
243
  await this.setHeader()
221
244
  var options: any = {
222
- signal: this.signal,
245
+ url: this.url + this.uri,
223
246
  method: !this.post ? "GET" : "POST",
247
+ cancelToken: this.abort.token,
224
248
  headers: {
225
249
  ...this.header,
226
250
  ["Content-Type"]: "application/x-www-form-urlencoded;charset=UTF-8"
227
251
  },
228
- body: this.post,
252
+ data: this.post,
229
253
  Cache: "no-store",
230
254
  Pragma: "no-cache",
231
255
  ['Cache-Control']: "no-store",
@@ -235,46 +259,19 @@ export default class ecurl {
235
259
  if (debug == 1)
236
260
  esp.log(this.url + this.uri, options)
237
261
  this.fetchConf = { url: this.url + this.uri, options: options }
238
- fetch(this.url + this.uri, options).then(async (res) => {
239
- var resText = await res.text()
240
- var resJson = (resText.startsWith("{") || resText.startsWith("[")) ? JSON.parse(resText) : null
241
- if (resJson) {
242
- if (onDone) onDone(resJson, false)
243
- this.onDone(resJson)
244
- } else {
245
- // Alert.alert(this.alertTimeout.title, this.alertTimeout.message, [
246
- // {
247
- // text: this.alertTimeout.ok,
248
- // style: 'cancel',
249
- // onPress: () => this.custom(uri, post, onDone, debug)
250
- // },
251
- // {
252
- // text: this.alertTimeout.cancel,
253
- // style: 'destructive',
254
- // onPress: () => { }
255
- // }
256
- // ])
257
- this.onFetchFailed(resText)
258
- LibProgress.hide()
259
- this.onError(resText)
262
+ // this.initTimeout()
263
+ axios(options).then(async (res: any) => {
264
+ // this.cancelTimeout()
265
+ if (res.data) {
266
+ if (onDone) onDone(res.data, false)
267
+ this.onDone(res.data)
260
268
  }
261
- }).catch((e) => {
262
269
  LibProgress.hide()
263
- // Alert.alert(this.alertTimeout.title, this.alertTimeout.message, [
264
- // {
265
- // text: this.alertTimeout.ok,
266
- // style: 'cancel',
267
- // onPress: () => this.custom(uri, post, onDone, debug)
268
- // },
269
- // {
270
- // text: this.alertTimeout.cancel,
271
- // style: 'destructive',
272
- // onPress: () => { }
273
- // }
274
- // ])
275
- this.onFetchFailed(e)
276
- // if (onDone)
277
- // onDone(e, true)
270
+ }).catch((r: string) => {
271
+ // this.cancelTimeout()
272
+ this.onFetchFailed(r)
273
+ LibProgress.hide()
274
+ this.onError(r)
278
275
  })
279
276
  }
280
277
  }
@@ -307,10 +304,11 @@ export default class ecurl {
307
304
  if (!upload)
308
305
  this.header["Content-Type"] = "application/x-www-form-urlencoded;charset=UTF-8"
309
306
  var options: any = {
310
- signal: this.signal,
307
+ url: this.url + this.uri,
311
308
  method: !this.post ? "GET" : "POST",
312
309
  headers: this.header,
313
- body: this.post,
310
+ data: this.post,
311
+ cancelToken: this.abort.token,
314
312
  cache: "no-store",
315
313
  Pragma: "no-cache",
316
314
  ["Cache-Control"]: 'no-cache, no-store, must-revalidate',
@@ -320,43 +318,18 @@ export default class ecurl {
320
318
  }
321
319
  if (debug == 1) esp.log(this.url + this.uri, options)
322
320
  this.fetchConf = { url: this.url + this.uri, options: options }
323
-
324
- // if (Platform.OS == 'android' && Platform.Version <= 22) {
325
- // var res = await fetch(this.url + this.uri, options);
326
- // let resText = await res.text()
327
- // this.onFetched(resText, onDone, onFailed, debug)
328
- // } else
329
- // if (!upload) {
330
- // LibWorker.curl(this.url + this.uri, options, async (resText) => {
331
- // if (typeof resText == 'string') {
332
- // this.onFetched(resText, onDone, onFailed, debug)
333
- // }
334
- // })
335
- // } else {
336
- fetch(this.url + this.uri, options).then(async (res) => {
337
- let resText = await res.text()
338
- this.onFetched(resText, onDone, onFailed, debug)
339
- }).catch((r) => {
340
- // Alert.alert(this.alertTimeout.title, this.alertTimeout.message, [
341
- // {
342
- // text: this.alertTimeout.ok,
343
- // style: 'cancel',
344
- // onPress: () => this.init(uri, post, onDone, onFailed, debug)
345
- // },
346
- // {
347
- // text: this.alertTimeout.cancel,
348
- // style: 'destructive',
349
- // onPress: () => { }
350
- // }
351
- // ])
352
- this.onFetchFailed(r)
353
- LibProgress.hide()
321
+ this.initTimeout(upload ? 120000 : undefined)
322
+ axios(options).then(async (res: any) => {
323
+ this.cancelTimeout()
324
+ this.onFetched(res.data, onDone, onFailed, debug)
325
+ }).catch((e: any) => {
326
+ this.cancelTimeout()
327
+ this.onFetched(e, onDone, onFailed, debug)
354
328
  })
355
- // }
356
329
  }
357
330
 
358
- onFetched(resText: string, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number): void {
359
- var resJson = (resText.startsWith("{") && resText.endsWith("}")) || (resText.startsWith("[") && resText.endsWith("]")) ? JSON.parse(resText) : resText
331
+ onFetched(resText: string | Object, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number): void {
332
+ var resJson = typeof resText == 'string' && ((resText.startsWith("{") && resText.endsWith("}")) || (resText.startsWith("[") && resText.endsWith("]"))) ? JSON.parse(resText) : resText
360
333
  if (typeof resJson == "object") {
361
334
  if (!resJson.status_code || this.onStatusCode(resJson.ok, resJson.status_code, resJson.message, resJson.result)) {
362
335
  if (resJson.ok === 1) {
@@ -368,22 +341,17 @@ export default class ecurl {
368
341
  }
369
342
  }
370
343
  } else {
371
- this.onFetchFailed(resText)
372
- this.onError(resText)
373
- // Alert.alert(this.alertTimeout.title, this.alertTimeout.message, [
374
- // {
375
- // text: this.alertTimeout.cancel,
376
- // style: 'destructive',
377
- // onPress: () => { }
378
- // }
379
- // ])
344
+ if (typeof resText == 'string') {
345
+ this.onFetchFailed(resText)
346
+ this.onError(resText)
347
+ }
380
348
  }
381
349
  }
382
350
 
383
351
  onError(msg: string): void {
384
352
  esp.log("\x1b[31m", msg)
385
353
  esp.log("\x1b[0m")
386
- if (esp.isDebug() && msg == '') {
354
+ if (esp.isDebug('') && msg == '') {
387
355
  return
388
356
  }
389
357
  reportApiError(this.fetchConf, msg)
@@ -107,16 +107,18 @@ class m extends LibComponent<LibImageProps, LibImageState> {
107
107
  const { status } = await ImagePicker.requestCameraPermissionsAsync();
108
108
  finalStatus = status
109
109
  }
110
- const rollPermission = await ImagePicker.getMediaLibraryPermissionsAsync();
111
- finalStatus = rollPermission.status
112
- if (finalStatus !== 'granted') {
113
- const { status } = await ImagePicker.requestMediaLibraryPermissionsAsync();
114
- finalStatus = status
110
+ if (finalStatus === 'granted') {
111
+ const rollPermission = await ImagePicker.getMediaLibraryPermissionsAsync();
112
+ finalStatus = rollPermission.status
113
+ if (finalStatus !== 'granted') {
114
+ const { status } = await ImagePicker.requestMediaLibraryPermissionsAsync();
115
+ finalStatus = status
116
+ }
115
117
  }
116
118
  if (finalStatus != 'granted') {
117
119
  Alert.alert(esp.appjson().expo.name + " tidak dapat mengakses kamera ", "Mohon Pastikan anda memberikan izin " + esp.appjson().expo.name + " untuk dapat mengambil foto")
118
120
  }
119
- ImagePicker.launchCameraAsync().then(async (result: any) => {
121
+ ImagePicker.launchCameraAsync({ presentationStyle: 0 }).then(async (result: any) => {
120
122
  if (!result)
121
123
  result = ImagePicker?.getPendingResultAsync()
122
124
  if (!result?.cancelled) {
@@ -141,7 +143,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
141
143
  static fromGallery(options?: LibImageGalleryOptions): Promise<string | string[]> {
142
144
  return new Promise((_r) => {
143
145
  setTimeout(async () => {
144
- const { status } = await ImagePicker.getCameraPermissionsAsync();
146
+ const { status } = await ImagePicker.getMediaLibraryPermissionsAsync();
145
147
  var finalStatus = status
146
148
  if (finalStatus !== 'granted') {
147
149
  const { status } = await ImagePicker.requestMediaLibraryPermissionsAsync();
@@ -158,7 +160,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
158
160
  max = 1
159
161
  }
160
162
  if (max == 1) {
161
- ImagePicker.launchImageLibraryAsync().then(async (x: any) => {
163
+ ImagePicker.launchImageLibraryAsync({ presentationStyle: 0 }).then(async (x: any) => {
162
164
  if (!x.cancelled) {
163
165
  if (options && options.crop) {
164
166
  m.showCropper(x.uri, options.crop.forceCrop, options.crop.ratio, options.crop?.message, async (x) => {
@@ -123,7 +123,9 @@ export default function m(props: LibPictureProps): any {
123
123
  }
124
124
 
125
125
  if (uri == '') {
126
- return <View style={props.style} />
126
+ return (
127
+ <View style={[{ backgroundColor: '#f1f2f3', borderRadius: 10 }, props.style]} />
128
+ )
127
129
  }
128
130
 
129
131
  return (
@@ -30,7 +30,7 @@ export default class m extends LibComponent<LibTabsProps, LibTabsState> {
30
30
  super(props);
31
31
  this.state = { forceUpdate: 0 }
32
32
  let page = this.props.defaultIndex || 0
33
- let pageOffset = props.tabOffset ? props.tabOffset : 1
33
+ let pageOffset = props.tabOffset != undefined ? props.tabOffset : 1
34
34
  this.buildAllIds = this.buildAllIds.bind(this);
35
35
  this.changePage = this.changePage.bind(this);
36
36
  this.arrayOfLimit = this.arrayOfLimit.bind(this);
@@ -61,7 +61,7 @@ export default class m extends LibComponent<LibTabsProps, LibTabsState> {
61
61
  componentDidUpdate(prevProps: LibTabsProps, prevState: LibTabsState): void {
62
62
  if (this.props.tabIndex != prevProps.tabIndex) {
63
63
  if (!this.allIds.includes(this.props.tabIndex)) {
64
- let pageOffset = this.props.tabOffset ? this.props.tabOffset : 1
64
+ let pageOffset = this.props.tabOffset != undefined ? this.props.tabOffset : 1
65
65
  this.buildAllIds(this.props.tabIndex, pageOffset)
66
66
  this.setState({ forceUpdate: this.state.forceUpdate + 1 })
67
67
  }
@@ -129,9 +129,6 @@ export default class eutils {
129
129
  } else {
130
130
  val = parseInt(value)?.toFixed?.(0)?.replace?.(/(\d)(?=(\d{3})+$)/g, "$1,")
131
131
  }
132
- if ((typeof value == "string" ? parseInt(value) : value) <= 0) {
133
- val = "0"
134
- }
135
132
  if (!currency) {
136
133
  currency = "Rp"
137
134
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.108",
3
+ "version": "0.0.109",
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",