esoftplay 0.0.178 → 0.0.180
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/modules/lib/carrousel.tsx +2 -2
- package/modules/lib/carrousel_snap.tsx +5 -5
- package/modules/lib/datepicker.tsx +4 -4
- package/modules/lib/image_crop.tsx +3 -3
- package/modules/lib/infinite.tsx +1 -1
- package/modules/lib/list.tsx +1 -1
- package/modules/lib/net_status.tsx +1 -1
- package/modules/lib/pin.tsx +2 -2
- package/modules/lib/scroll.tsx +1 -1
- package/package.json +1 -1
|
@@ -226,9 +226,9 @@ export default class m extends LibComponent<LibCarrouselProps, LibCarrouselState
|
|
|
226
226
|
|
|
227
227
|
_scrollTo({ offset, animated, nofix }: any): void {
|
|
228
228
|
if (typeof this.scrollView?.current?.scrollTo == 'function') {
|
|
229
|
-
this.scrollView.current
|
|
229
|
+
this.scrollView.current?.scrollTo({ y: 0, x: offset, animated });
|
|
230
230
|
if (!nofix && Platform.OS === 'android' && !animated) {
|
|
231
|
-
this.scrollView.current
|
|
231
|
+
this.scrollView.current?.scrollTo({ y: 0, x: offset, animated: true });
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
// noPage
|
|
3
3
|
import esp from 'esoftplay/esp';
|
|
4
|
-
import
|
|
4
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
5
5
|
import { ScrollView, StyleProp, View, ViewStyle } from 'react-native';
|
|
6
6
|
|
|
7
7
|
export interface LibCarrousel_snapProps {
|
|
@@ -42,7 +42,7 @@ export default function m(props: LibCarrousel_snapProps): any {
|
|
|
42
42
|
}
|
|
43
43
|
thisPage = initialPage
|
|
44
44
|
if (props.onChangePage) props.onChangePage(indexes[initialPage])
|
|
45
|
-
sRef.current
|
|
45
|
+
sRef.current?.scrollTo({ x: renderOffsets[initialPage], animated: false })
|
|
46
46
|
if (autoCycle && props.loop && props.align == 'center')
|
|
47
47
|
timmer()
|
|
48
48
|
return () => {
|
|
@@ -79,13 +79,13 @@ export default function m(props: LibCarrousel_snapProps): any {
|
|
|
79
79
|
if (out >= (props.data.length + adderLength)) {
|
|
80
80
|
const a = indexes[out];
|
|
81
81
|
const b = indexsData.indexOf(a) + adderLength
|
|
82
|
-
sRef.current
|
|
82
|
+
sRef.current?.scrollTo({ x: renderOffsets[out], animated: true })
|
|
83
83
|
thisPage = b
|
|
84
84
|
return
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
thisPage = out
|
|
88
|
-
sRef.current
|
|
88
|
+
sRef.current?.scrollTo({ x: renderOffsets[out], animated: true })
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
function onChangePage(e: any) {
|
|
@@ -105,7 +105,7 @@ export default function m(props: LibCarrousel_snapProps): any {
|
|
|
105
105
|
if (x <= adderLength || x >= (props.data.length + adderLength)) {
|
|
106
106
|
const a = indexes[x];
|
|
107
107
|
const b = indexsData.indexOf(a) + adderLength
|
|
108
|
-
sRef.current
|
|
108
|
+
sRef.current?.scrollTo({ x: renderOffsets[b], animated: false })
|
|
109
109
|
thisPage = b
|
|
110
110
|
if (timmerTick) {
|
|
111
111
|
clearInterval(timmerTick)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import esp from 'esoftplay/esp';
|
|
5
5
|
import useSafeState from 'esoftplay/state';
|
|
6
6
|
import { LinearGradient } from 'expo-linear-gradient';
|
|
7
|
-
import
|
|
7
|
+
import { useEffect, useRef } from 'react';
|
|
8
8
|
import { Text, TouchableOpacity, View } from 'react-native';
|
|
9
9
|
type DateFormat = `${number}-${number}-${number}`
|
|
10
10
|
export interface LibDatepickerProps {
|
|
@@ -137,9 +137,9 @@ export default function m(props: LibDatepickerProps): any {
|
|
|
137
137
|
}, [month, year])
|
|
138
138
|
|
|
139
139
|
function getDateChange() {
|
|
140
|
-
const monthNumber = allMonths.indexOf(refMonth.current
|
|
141
|
-
const date = refDate.current
|
|
142
|
-
const dateSelected = refYear.current
|
|
140
|
+
const monthNumber = allMonths.indexOf(refMonth.current?.getSelected()) + 1
|
|
141
|
+
const date = refDate.current?.getSelected()
|
|
142
|
+
const dateSelected = refYear.current?.getSelected() + '-' + String(monthNumber < 10 ? ('0' + monthNumber) : monthNumber) + '-' + String(date < 10 ? ('0' + date) : date)
|
|
143
143
|
if (props.onDateChange)
|
|
144
144
|
props.onDateChange(dateSelected)
|
|
145
145
|
else {
|
|
@@ -3,7 +3,7 @@ import esp from 'esoftplay/esp';
|
|
|
3
3
|
import useSafeState from 'esoftplay/state';
|
|
4
4
|
|
|
5
5
|
import * as ImageManipulator from "expo-image-manipulator";
|
|
6
|
-
import
|
|
6
|
+
import { useEffect, useRef } from 'react';
|
|
7
7
|
import { Image, Pressable, Text, TouchableOpacity, View } from 'react-native';
|
|
8
8
|
import PanPinchView from "react-native-pan-pinch-view";
|
|
9
9
|
|
|
@@ -109,7 +109,7 @@ export default function m(props: LibImage_cropProps): any {
|
|
|
109
109
|
pageY: 0
|
|
110
110
|
}
|
|
111
111
|
Image.getSize(_image, (actualWidth, actualHeight) => {
|
|
112
|
-
viewRef.current
|
|
112
|
+
viewRef.current?.measure((...vls: number[]) => {
|
|
113
113
|
crop = {
|
|
114
114
|
x: vls[0],
|
|
115
115
|
y: vls[1],
|
|
@@ -118,7 +118,7 @@ export default function m(props: LibImage_cropProps): any {
|
|
|
118
118
|
pageX: vls[4],
|
|
119
119
|
pageY: vls[5]
|
|
120
120
|
}
|
|
121
|
-
imageRef.current
|
|
121
|
+
imageRef.current?.measure((...vls: number[]) => {
|
|
122
122
|
img = {
|
|
123
123
|
x: vls[0],
|
|
124
124
|
y: vls[1],
|
package/modules/lib/infinite.tsx
CHANGED
|
@@ -187,7 +187,7 @@ export default class m extends LibComponent<LibInfiniteProps, LibInfiniteState>
|
|
|
187
187
|
|
|
188
188
|
scrollToIndex(x: number, anim?: boolean, viewOffset?: number, viewPosition?: number): void {
|
|
189
189
|
if (!anim) anim = true;
|
|
190
|
-
this.flatlist.current
|
|
190
|
+
this.flatlist.current?.scrollToIndex({ index: x, animated: anim, viewOffset: viewOffset, viewPosition: viewPosition })
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
render(): any {
|
package/modules/lib/list.tsx
CHANGED
|
@@ -61,7 +61,7 @@ export default class m extends LibComponent<LibListProps, LibListState> {
|
|
|
61
61
|
|
|
62
62
|
scrollToIndex(x: number, anim?: boolean, viewOffset?: number, viewPosition?: number): void {
|
|
63
63
|
if (!anim) anim = true;
|
|
64
|
-
this.flatlist.current
|
|
64
|
+
this.flatlist.current?.scrollToIndex({ index: x, animated: anim, viewOffset: viewOffset, viewPosition: viewPosition })
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
rowRenderer({ item, index }): any {
|
|
@@ -39,7 +39,7 @@ class net_status extends LibComponent<LibNet_statusProps, LibNet_statusState> {
|
|
|
39
39
|
|
|
40
40
|
/** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/modules/lib/net_status.md#setOnline) untuk melihat dokumentasi*/
|
|
41
41
|
static setOnline(isOnline: boolean, isInternetReachable: boolean): void {
|
|
42
|
-
subscriber.trigger({ isOnline, isInternetReachable })
|
|
42
|
+
net_status.subscriber.trigger({ isOnline, isInternetReachable })
|
|
43
43
|
state.set({ isOnline: isOnline, isInternetReachable: isInternetReachable })
|
|
44
44
|
}
|
|
45
45
|
|
package/modules/lib/pin.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
// noPage
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { TextInput, View, ViewStyle } from 'react-native';
|
|
6
6
|
|
|
7
7
|
export interface LibPinProps {
|
|
@@ -48,7 +48,7 @@ export default function m(props: LibPinProps): any {
|
|
|
48
48
|
autoFocus
|
|
49
49
|
onChangeText={(t: string) => {
|
|
50
50
|
if (t.length == props.length) {
|
|
51
|
-
input.current
|
|
51
|
+
input.current?.blur()
|
|
52
52
|
}
|
|
53
53
|
let _t: string[] = t.split('')
|
|
54
54
|
setPin(_t)
|
package/modules/lib/scroll.tsx
CHANGED
|
@@ -73,7 +73,7 @@ export default class m extends LibComponent<LibScrollProps, LibScrollState> {
|
|
|
73
73
|
|
|
74
74
|
scrollToIndex(x: number, anim?: boolean): void {
|
|
75
75
|
if (anim == undefined) anim = true;
|
|
76
|
-
this.flatscroll.current
|
|
76
|
+
this.flatscroll.current?.scrollTo({
|
|
77
77
|
x: this.props.horizontal ? this.idxNumber[x] : 0,
|
|
78
78
|
y: !this.props.horizontal ? this.idxNumber[x] : 0,
|
|
79
79
|
animated: anim
|