esoftplay 0.0.105 → 0.0.106
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/bin/build.js +0 -1
- package/bin/cli.js +0 -0
- package/bin/router.js +1 -1
- package/esp.ts +4 -2
- package/global.ts +25 -5
- package/modules/content/category_list.tsx +2 -1
- package/modules/content/gallery.tsx +5 -9
- package/modules/lib/collaps.tsx +47 -86
- package/modules/lib/curl.ts +1 -1
- package/modules/lib/image.tsx +13 -48
- package/modules/lib/image_multi.tsx +1 -0
- package/modules/lib/menu.tsx +1 -0
- package/modules/lib/object.ts +60 -1
- package/modules/lib/pin.tsx +32 -18
- package/modules/lib/scroll.tsx +1 -0
- package/modules/lib/skeleton.tsx +106 -0
- package/modules/lib/slidingup.tsx +4 -2
- package/modules/lib/tabs.tsx +1 -0
- package/modules/lib/utils.ts +1 -1
- package/modules/lib/version.tsx +1 -1
- package/modules/user/index.tsx +10 -17
- package/modules/user/loading.tsx +15 -0
- package/moment.ts +9 -2
- package/package.json +1 -1
- package/modules/lib/image_edit.tsx +0 -37
package/bin/build.js
CHANGED
package/bin/cli.js
CHANGED
|
File without changes
|
package/bin/router.js
CHANGED
|
@@ -375,7 +375,7 @@ declare module "esoftplay" {
|
|
|
375
375
|
function reducer(): any;
|
|
376
376
|
function versionName(): string;
|
|
377
377
|
function navigations(): any;
|
|
378
|
-
function isDebug(): boolean;
|
|
378
|
+
function isDebug(message: string): boolean;
|
|
379
379
|
function lang(moduleTask: string, langName: string, ...string: string[]): string;
|
|
380
380
|
function langId(): string;
|
|
381
381
|
function home(): any;
|
package/esp.ts
CHANGED
|
@@ -4,7 +4,9 @@ import routers from './cache/routers';
|
|
|
4
4
|
import { Platform } from 'react-native';
|
|
5
5
|
import { _global, esp, LibLocale, UserRoutes } from 'esoftplay';
|
|
6
6
|
import { LogBox } from 'react-native';
|
|
7
|
+
import Constants from 'expo-constants';
|
|
7
8
|
LogBox.ignoreLogs(['YellowBox has been replaced with LogBox. Please call LogBox.ignoreLogs() instead.']);
|
|
9
|
+
LogBox.ignoreLogs(['VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead.']);
|
|
8
10
|
let app = require('../../app.json');
|
|
9
11
|
let conf = require('../../config.json');
|
|
10
12
|
let lconf = require('../../config.live.json');
|
|
@@ -40,7 +42,7 @@ export default (() => {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
function versionName(): string {
|
|
43
|
-
return (Platform.OS == 'android' ?
|
|
45
|
+
return (Platform.OS == 'android' ? Constants.manifest.android.versionCode : Constants.manifest.ios.buildNumber) + '-' + config('publish_id')
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
function config(param?: string, ...params: string[]): any {
|
|
@@ -60,7 +62,7 @@ export default (() => {
|
|
|
60
62
|
return out;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
function isDebug(): boolean {
|
|
65
|
+
function isDebug(message: string): boolean {
|
|
64
66
|
if (!lconf) {
|
|
65
67
|
return false
|
|
66
68
|
}
|
package/global.ts
CHANGED
|
@@ -28,13 +28,18 @@ _global.useGlobalUserDelete = {}
|
|
|
28
28
|
class Context {
|
|
29
29
|
idx = 0
|
|
30
30
|
increment = () => this.idx++
|
|
31
|
-
reset = () =>
|
|
31
|
+
reset = () => {
|
|
32
|
+
this.idx = 0
|
|
33
|
+
}
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export const globalIdx = new Context()
|
|
35
37
|
|
|
36
38
|
const n = () => {
|
|
37
39
|
let subscriber = {}
|
|
40
|
+
let debouceTime
|
|
41
|
+
let persistKeys: any = {}
|
|
42
|
+
|
|
38
43
|
function m<T>(initValue: T, o?: useGlobalOption): useGlobalReturn<T> {
|
|
39
44
|
const _idx = globalIdx.idx
|
|
40
45
|
if (!subscriber[_idx])
|
|
@@ -43,10 +48,7 @@ const n = () => {
|
|
|
43
48
|
|
|
44
49
|
// rehidryte instant
|
|
45
50
|
if (o?.persistKey) {
|
|
46
|
-
|
|
47
|
-
if (p)
|
|
48
|
-
set(JSON.parse(p))
|
|
49
|
-
})
|
|
51
|
+
rehidryte(o.persistKey, (p) => { if (typeof p == 'string') set(JSON.parse(p)) })
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
/* register to userData to automatically reset state and persist */
|
|
@@ -137,6 +139,24 @@ const n = () => {
|
|
|
137
139
|
globalIdx.increment()
|
|
138
140
|
return { useState, get, set, useSelector, reset: del, connect: _connect };
|
|
139
141
|
}
|
|
142
|
+
|
|
143
|
+
function debounce(func: () => any, delay: number): void {
|
|
144
|
+
clearTimeout(debouceTime)
|
|
145
|
+
debouceTime = setTimeout(() => func(), delay)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function rehidryte(key: string, func: (e: string) => void) {
|
|
149
|
+
persistKeys[key] = func
|
|
150
|
+
debounce(() => {
|
|
151
|
+
AsyncStorage.multiGet(Object.keys(persistKeys), (e, v) => {
|
|
152
|
+
if (v && !e) {
|
|
153
|
+
Object.entries(persistKeys).forEach((item: any, idx) => {
|
|
154
|
+
item?.[1]?.(v[item?.[0]])
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
}, 50)
|
|
159
|
+
}
|
|
140
160
|
return m
|
|
141
161
|
}
|
|
142
162
|
|
|
@@ -34,7 +34,8 @@ export default function m(props: ContentCategory_listProps): any {
|
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
36
|
<View style={{}} >
|
|
37
|
-
<ScrollView horizontal
|
|
37
|
+
<ScrollView horizontal nestedScrollEnabled
|
|
38
|
+
style={{ margin: 0 }} >
|
|
38
39
|
{
|
|
39
40
|
menu?.list?.[0]?.filter?.((row: any) => row.par_id == id).map((row: any) => (
|
|
40
41
|
<Pressable
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
|
|
3
3
|
import React, { useRef } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { Pressable, ScrollView } from 'react-native';
|
|
5
5
|
import Gallery from 'react-native-awesome-gallery';
|
|
6
6
|
import { LibIcon, LibNavigation, LibStyle, LibUtils } from 'esoftplay'
|
|
7
7
|
|
|
@@ -24,21 +24,17 @@ export default function m(props: ContentGalleryProps): any {
|
|
|
24
24
|
description: ""
|
|
25
25
|
})
|
|
26
26
|
}
|
|
27
|
+
|
|
27
28
|
return (
|
|
28
|
-
<ScrollView
|
|
29
|
+
<ScrollView nestedScrollEnabled
|
|
30
|
+
style={{ flex: 1, backgroundColor: 'black' }} >
|
|
29
31
|
<Gallery
|
|
30
32
|
data={images.map((image) => (image?.image))}
|
|
31
33
|
onSwipeToClose={() => {
|
|
32
34
|
if (scale == 1)
|
|
33
35
|
LibNavigation.back()
|
|
34
36
|
}}
|
|
35
|
-
maxScale={
|
|
36
|
-
renderItem={(renderItemInfo) => {
|
|
37
|
-
Image.getSize(String(renderItemInfo.item), (w, h) => {
|
|
38
|
-
renderItemInfo.setImageDimensions({ width: w, height: h })
|
|
39
|
-
})
|
|
40
|
-
return <Image style={{ flex: 1, resizeMode: 'contain' }} source={{ uri: String(renderItemInfo.item) }} />
|
|
41
|
-
}}
|
|
37
|
+
maxScale={6}
|
|
42
38
|
disableTransitionOnScaledImage
|
|
43
39
|
onScaleChange={(sc) => scale = sc}
|
|
44
40
|
doubleTapScale={4}
|
package/modules/lib/collaps.tsx
CHANGED
|
@@ -1,97 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, Animated } from 'react-native';
|
|
3
|
-
import { LibComponent, LibStyle, LibTheme, esp } from 'esoftplay';
|
|
4
|
-
const { elevation } = LibStyle;
|
|
1
|
+
// withHooks
|
|
5
2
|
|
|
3
|
+
import { useSafeState } from 'esoftplay';
|
|
4
|
+
import React, { useCallback } from 'react';
|
|
5
|
+
import { Pressable } from 'react-native';
|
|
6
|
+
import Animated, { Easing, interpolate, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export interface LibCollapsArgs {
|
|
10
|
+
}
|
|
6
11
|
export interface LibCollapsProps {
|
|
7
12
|
show?: boolean,
|
|
8
13
|
header: (isShow: boolean) => any,
|
|
9
14
|
children: any,
|
|
10
15
|
style?: any
|
|
11
16
|
}
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.initState = this.initState.bind(this)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
initState(): void {
|
|
36
|
-
let height = this.state.expanded ? (this.state.maxHeight + this.state.minHeight) : this.state.minHeight
|
|
37
|
-
this.setState({
|
|
38
|
-
animation: new Animated.Value(height)
|
|
17
|
+
export default function m(props: LibCollapsProps): any {
|
|
18
|
+
const animHeight = useSharedValue(-1)
|
|
19
|
+
const bodyHeight = useSharedValue(1)
|
|
20
|
+
const [expand, setExpand] = useSafeState(props.show)
|
|
21
|
+
|
|
22
|
+
const heightStyle = useAnimatedStyle(() => {
|
|
23
|
+
return {
|
|
24
|
+
overflow: 'hidden',
|
|
25
|
+
height: interpolate(animHeight.value,
|
|
26
|
+
[0, 1, 2],
|
|
27
|
+
[0, bodyHeight.value, bodyHeight.value]),
|
|
28
|
+
opacity: interpolate(animHeight.value,
|
|
29
|
+
[-1, 0],
|
|
30
|
+
[0, 1])
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const toggle = useCallback(() => {
|
|
35
|
+
animHeight.value = withTiming(animHeight.value == 0 ? 1 : 0, {
|
|
36
|
+
easing: Easing.sin
|
|
39
37
|
})
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
this.state.animation.setValue(initialValue);
|
|
51
|
-
Animated.spring(
|
|
52
|
-
this.state.animation,
|
|
53
|
-
{
|
|
54
|
-
toValue: finalValue,
|
|
55
|
-
useNativeDriver: false
|
|
56
|
-
}
|
|
57
|
-
).start();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
_setMaxHeight(event: any): void {
|
|
61
|
-
if (this.state.maxHeight == 0) {
|
|
62
|
-
this.setState({ maxHeight: event.nativeEvent.layout.height + 15 }, () => {
|
|
63
|
-
if (this.state.minHeight > 0 && this.state.maxHeight > 0) {
|
|
64
|
-
this.initState()
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
_setMinHeight(event: any): void {
|
|
71
|
-
if (this.state.minHeight == 0)
|
|
72
|
-
this.setState(
|
|
73
|
-
{
|
|
74
|
-
minHeight: event.nativeEvent.layout.height,
|
|
75
|
-
}, () => {
|
|
76
|
-
if (this.state.minHeight > 0 && this.state.maxHeight > 0) {
|
|
77
|
-
this.initState()
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
render(): any {
|
|
83
|
-
return (
|
|
38
|
+
setExpand(animHeight.value != 1)
|
|
39
|
+
}, [])
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Animated.View style={{ overflow: 'hidden' }} >
|
|
43
|
+
<Pressable onPress={toggle} >
|
|
44
|
+
{props.header(expand)}
|
|
45
|
+
</Pressable>
|
|
84
46
|
<Animated.View
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
</View>
|
|
47
|
+
onLayout={({ nativeEvent: { layout: { height } } }) => {
|
|
48
|
+
if (height && animHeight.value == -1) {
|
|
49
|
+
bodyHeight.value = height + 5
|
|
50
|
+
animHeight.value = props.show ? 1 : 0
|
|
51
|
+
}
|
|
52
|
+
}}
|
|
53
|
+
style={[heightStyle]}>
|
|
54
|
+
{props.children}
|
|
94
55
|
</Animated.View>
|
|
95
|
-
|
|
96
|
-
|
|
56
|
+
</Animated.View>
|
|
57
|
+
)
|
|
97
58
|
}
|
package/modules/lib/curl.ts
CHANGED
package/modules/lib/image.tsx
CHANGED
|
@@ -24,7 +24,6 @@ export interface LibImageProps {
|
|
|
24
24
|
show?: boolean,
|
|
25
25
|
image?: string,
|
|
26
26
|
maxDimension?: number,
|
|
27
|
-
editor?: boolean,
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export interface LibImageState {
|
|
@@ -36,7 +35,6 @@ export interface LibImageState {
|
|
|
36
35
|
|
|
37
36
|
export interface LibImageGalleryOptions {
|
|
38
37
|
crop?: LibImageCrop
|
|
39
|
-
editor?: boolean,
|
|
40
38
|
maxDimension?: number,
|
|
41
39
|
multiple?: boolean,
|
|
42
40
|
max?: number
|
|
@@ -45,13 +43,11 @@ export interface LibImageGalleryOptions {
|
|
|
45
43
|
export interface LibImageCameraOptions {
|
|
46
44
|
crop?: LibImageCrop
|
|
47
45
|
maxDimension?: number,
|
|
48
|
-
editor?: boolean
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
const initState = {
|
|
52
49
|
show: false,
|
|
53
50
|
image: undefined,
|
|
54
|
-
editor: false,
|
|
55
51
|
maxDimension: 1280
|
|
56
52
|
}
|
|
57
53
|
const state = useGlobalState(initState)
|
|
@@ -63,16 +59,14 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
63
59
|
...state.get(),
|
|
64
60
|
image: image,
|
|
65
61
|
show: false,
|
|
66
|
-
editor: false,
|
|
67
62
|
})
|
|
68
63
|
}
|
|
69
64
|
|
|
70
|
-
static show(
|
|
65
|
+
static show(): void {
|
|
71
66
|
state.set({
|
|
72
67
|
...state.get(),
|
|
73
68
|
show: true,
|
|
74
69
|
image: undefined,
|
|
75
|
-
editor: editor,
|
|
76
70
|
})
|
|
77
71
|
}
|
|
78
72
|
|
|
@@ -96,20 +90,11 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
96
90
|
async takePicture(): Promise<void> {
|
|
97
91
|
if (this.camera) {
|
|
98
92
|
this.setState({ loading: true })
|
|
99
|
-
const { editor } = this.props
|
|
100
93
|
let result = await this.camera.takePictureAsync({})
|
|
101
94
|
this.setState({ image: result, loading: false })
|
|
102
|
-
if (editor) {
|
|
103
|
-
m.showEditor(result.uri, (d) => {
|
|
104
|
-
this.setState({ image: d, loading: false })
|
|
105
|
-
})
|
|
106
|
-
}
|
|
107
95
|
}
|
|
108
96
|
}
|
|
109
97
|
|
|
110
|
-
static showEditor(uri: string, result: (x: any) => void): void {
|
|
111
|
-
LibNavigation.navigateForResult("lib/image_edit", { uri }, 81793).then(result)
|
|
112
|
-
}
|
|
113
98
|
static showCropper(uri: string, forceCrop: boolean, ratio: string, message: string, result: (x: any) => void): void {
|
|
114
99
|
LibNavigation.navigateForResult("lib/image_crop", { image: uri, forceCrop, ratio, message }, 81793).then(result)
|
|
115
100
|
}
|
|
@@ -143,18 +128,11 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
143
128
|
m.setResult(imageUri)
|
|
144
129
|
_r(imageUri)
|
|
145
130
|
})
|
|
146
|
-
} else
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
_r(imageUri)
|
|
152
|
-
})
|
|
153
|
-
} else {
|
|
154
|
-
let imageUri = await m.processImage(result, options?.maxDimension)
|
|
155
|
-
m.setResult(imageUri)
|
|
156
|
-
_r(imageUri)
|
|
157
|
-
}
|
|
131
|
+
} else {
|
|
132
|
+
let imageUri = await m.processImage(result, options?.maxDimension)
|
|
133
|
+
m.setResult(imageUri)
|
|
134
|
+
_r(imageUri)
|
|
135
|
+
}
|
|
158
136
|
}
|
|
159
137
|
})
|
|
160
138
|
// }
|
|
@@ -190,19 +168,11 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
190
168
|
m.setResult(imageUri)
|
|
191
169
|
_r(imageUri)
|
|
192
170
|
})
|
|
193
|
-
} else
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
_r(imageUri)
|
|
199
|
-
})
|
|
200
|
-
return
|
|
201
|
-
} else {
|
|
202
|
-
let imageUri = await m.processImage(x, options?.maxDimension)
|
|
203
|
-
m.setResult(imageUri)
|
|
204
|
-
_r(imageUri)
|
|
205
|
-
}
|
|
171
|
+
} else {
|
|
172
|
+
let imageUri = await m.processImage(x, options?.maxDimension)
|
|
173
|
+
m.setResult(imageUri)
|
|
174
|
+
_r(imageUri)
|
|
175
|
+
}
|
|
206
176
|
}
|
|
207
177
|
})
|
|
208
178
|
return
|
|
@@ -215,12 +185,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
215
185
|
m.setResult(imageUri)
|
|
216
186
|
_r(imageUri)
|
|
217
187
|
})
|
|
218
|
-
}
|
|
219
|
-
m.showEditor(x[0].uri, async (x) => {
|
|
220
|
-
let imageUri = await m.processImage(x, options?.maxDimension)
|
|
221
|
-
m.setResult(imageUri)
|
|
222
|
-
_r(imageUri)
|
|
223
|
-
})
|
|
188
|
+
}
|
|
224
189
|
return
|
|
225
190
|
}
|
|
226
191
|
let a: string[] = []
|
|
@@ -308,7 +273,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
308
273
|
return (
|
|
309
274
|
<state.connect
|
|
310
275
|
render={(props) => {
|
|
311
|
-
const { show,
|
|
276
|
+
const { show, maxDimension } = props
|
|
312
277
|
if (!show) return null
|
|
313
278
|
return (
|
|
314
279
|
<View style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }} >
|
|
@@ -94,6 +94,7 @@ export default function m(props: LibImage_multiProps): any {
|
|
|
94
94
|
showsVerticalScrollIndicator={false}
|
|
95
95
|
initialNumToRender={5}
|
|
96
96
|
maxToRenderPerBatch={10}
|
|
97
|
+
nestedScrollEnabled
|
|
97
98
|
windowSize={5}
|
|
98
99
|
style={{ paddingHorizontal: 0.5, flex: 1 }}
|
|
99
100
|
onEndReached={() => getPhotos()}
|
package/modules/lib/menu.tsx
CHANGED
|
@@ -41,6 +41,7 @@ export default class emenu extends LibComponent<LibMenuProps, LibMenuState> {
|
|
|
41
41
|
<FlatList
|
|
42
42
|
style={style}
|
|
43
43
|
data={data}
|
|
44
|
+
nestedScrollEnabled
|
|
44
45
|
keyExtractor={(item: any) => (item.id).toString()}
|
|
45
46
|
renderItem={({ item }: any) => <LibMenusub {...item} selectedId={this.props.selectedId} data={this.props.data} parent={parent} onClick={(item: any) => this.onItemSelected(item)} />}
|
|
46
47
|
/>
|
package/modules/lib/object.ts
CHANGED
|
@@ -1,7 +1,66 @@
|
|
|
1
|
-
import { fastFilter } from './../../fast';
|
|
2
1
|
import { update } from "immhelper";
|
|
3
2
|
|
|
4
3
|
export default class m {
|
|
4
|
+
_value = undefined
|
|
5
|
+
|
|
6
|
+
constructor(array: any) {
|
|
7
|
+
this._value = array
|
|
8
|
+
this.value = this.value.bind(this)
|
|
9
|
+
this.push = this.push.bind(this)
|
|
10
|
+
this.unset = this.unset.bind(this)
|
|
11
|
+
this.unshift = this.unshift.bind(this)
|
|
12
|
+
this.set = this.set.bind(this)
|
|
13
|
+
this.splice = this.splice.bind(this)
|
|
14
|
+
this.update = this.update.bind(this)
|
|
15
|
+
this.assign = this.assign.bind(this)
|
|
16
|
+
this.cursorBuilder = this.cursorBuilder.bind(this)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
cursorBuilder(command: string, array: any, value: any, ...values: any[]): (cursor?: string | number, ...cursors: (string | number)[]) => this {
|
|
20
|
+
return (cursor?: string | number, ...cursors: (string | number)[]) => {
|
|
21
|
+
let pathToUpdate = [cursor, ...cursors].filter(x => x != undefined).join('.')
|
|
22
|
+
let allValues = [value, ...values].filter(x => x != undefined)
|
|
23
|
+
let spec = {}
|
|
24
|
+
if (pathToUpdate != '')
|
|
25
|
+
spec = { [pathToUpdate]: [command, ...allValues] }
|
|
26
|
+
else
|
|
27
|
+
spec = [command, ...allValues]
|
|
28
|
+
this._value = update(array, spec)
|
|
29
|
+
return this
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
push(value?: any, ...values: any[]): (cursor?: string | number, ...cursors: (string | number)[]) => this {
|
|
34
|
+
return this.cursorBuilder("push", this._value, value, ...values)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
unshift(value?: any, ...values: any[]): (cursor?: string | number, ...cursors: (string | number)[]) => this {
|
|
38
|
+
return this.cursorBuilder("unshift", this._value, value, ...values)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
splice(index: number, deleteCount: number, value?: any, ...values: any[]): (cursor?: string | number, ...cursors: (string | number)[]) => this {
|
|
42
|
+
return this.cursorBuilder("splice", this._value, index, deleteCount, value, ...values)
|
|
43
|
+
}
|
|
44
|
+
unset(index: number | string, ...indexs: (string | number)[]): (cursor?: string | number, ...cursors: (string | number)[]) => this {
|
|
45
|
+
return this.cursorBuilder("unset", this._value, index, ...indexs)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
set(value: any): (cursor?: string | number, ...cursors: (string | number)[]) => this {
|
|
49
|
+
return this.cursorBuilder("set", this._value, value)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
update(callback: (lastValue: any) => any): (cursor?: string | number, ...cursors: (string | number)[]) => this {
|
|
53
|
+
return this.cursorBuilder("batch", this._value, callback)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
assign(obj1: any): (cursor?: string | number, ...cursors: (string | number)[]) => this {
|
|
57
|
+
return this.cursorBuilder("assign", this._value, obj1)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
value(): any {
|
|
61
|
+
return this._value
|
|
62
|
+
}
|
|
63
|
+
|
|
5
64
|
static push(array: any, value?: any, ...values: any[]): (cursor?: string | number, ...cursors: (string | number)[]) => any {
|
|
6
65
|
return cursorBuilder("push", array, value, ...values)
|
|
7
66
|
}
|
package/modules/lib/pin.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
|
|
3
|
-
import React, { useState, useRef } from 'react';
|
|
3
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
4
4
|
import { View, TextInput } from 'react-native';
|
|
5
5
|
|
|
6
6
|
|
|
@@ -8,38 +8,52 @@ export interface LibPinProps {
|
|
|
8
8
|
length: number,
|
|
9
9
|
onChangePin: (pin: string) => void
|
|
10
10
|
boxStyle?: any,
|
|
11
|
+
overrideKeyboard?: boolean,
|
|
12
|
+
pinValue?: string,
|
|
11
13
|
pinStyle?: any
|
|
12
14
|
}
|
|
13
15
|
export default function m(props: LibPinProps): any {
|
|
14
16
|
const [pin, setPin] = useState<string[]>([])
|
|
15
17
|
const input = useRef<TextInput>(null)
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setPin(props?.pinValue?.split?.(''))
|
|
21
|
+
props.onChangePin(props?.pinValue || '')
|
|
22
|
+
}, [props.pinValue])
|
|
23
|
+
|
|
16
24
|
return (
|
|
17
25
|
<View>
|
|
18
26
|
<View style={{ alignItems: 'center', marginTop: 20 }} >
|
|
19
27
|
<View style={{ height: 70 }} >
|
|
20
28
|
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }} >
|
|
21
29
|
{
|
|
22
|
-
new Array(props.length).fill('').map((_,
|
|
23
|
-
<View key={
|
|
24
|
-
{!!pin[
|
|
30
|
+
new Array(props.length).fill('').map((_, i) => (
|
|
31
|
+
<View key={i} style={{ height: 40, width: 40, margin: 5, borderRadius: 4, borderWidth: 0.5, borderColor: '#444', ...props.boxStyle, alignItems: 'center', justifyContent: 'center' }}>
|
|
32
|
+
{!!pin?.[i] && <View style={{ height: 10, width: 10, borderRadius: 5, backgroundColor: '#444', ...props.pinStyle }} />}
|
|
25
33
|
</View>
|
|
26
34
|
))
|
|
27
35
|
}
|
|
28
36
|
</View>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
{
|
|
38
|
+
!props.overrideKeyboard &&
|
|
39
|
+
<View style={{ flexDirection: 'row', width: 60 * props.length, alignSelf: 'center', justifyContent: 'center' }} >
|
|
40
|
+
<TextInput
|
|
41
|
+
ref={input}
|
|
42
|
+
contextMenuHidden={true}
|
|
43
|
+
keyboardType='numeric'
|
|
44
|
+
secureTextEntry
|
|
45
|
+
style={{ opacity: 0, marginLeft: -400, width: 400 + 60 * props.length, fontSize: 0, height: 60, marginTop: -40, alignSelf: 'flex-start' }}
|
|
46
|
+
autoFocus
|
|
47
|
+
onChangeText={(t: string) => {
|
|
48
|
+
if (t.length == props.length) {
|
|
49
|
+
input.current!.blur()
|
|
50
|
+
}
|
|
51
|
+
let _t: string[] = t.split('')
|
|
52
|
+
setPin(_t)
|
|
53
|
+
props.onChangePin(t)
|
|
54
|
+
}} maxLength={props.length} />
|
|
55
|
+
</View>
|
|
56
|
+
}
|
|
43
57
|
</View>
|
|
44
58
|
</View>
|
|
45
59
|
</View>
|
package/modules/lib/scroll.tsx
CHANGED
|
@@ -89,6 +89,7 @@ export default class escroll extends LibComponent<LibScrollProps, LibScrollState
|
|
|
89
89
|
ref={this.flatscroll}
|
|
90
90
|
scrollEventThrottle={64}
|
|
91
91
|
showsHorizontalScrollIndicator={false}
|
|
92
|
+
nestedScrollEnabled
|
|
92
93
|
showsVerticalScrollIndicator={false}
|
|
93
94
|
{...this.props}
|
|
94
95
|
refreshControl={this.props.onRefresh && <RefreshControl onRefresh={this.props.onRefresh} refreshing={false} />} >
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { LibComponent, LibSkeleton } from 'esoftplay';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { LibStyle } from 'esoftplay';
|
|
5
|
+
import { LinearGradient } from 'expo-linear-gradient';
|
|
6
|
+
import MaskedView from '@react-native-masked-view/masked-view';
|
|
7
|
+
import Animated, { useSharedValue, useAnimatedStyle, withRepeat, withTiming } from 'react-native-reanimated';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export interface LibSkeletonProps {
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
export interface LibSkeletonState {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
export interface LibSkeletonStatic {
|
|
17
|
+
size: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export default class m extends LibComponent<LibSkeletonProps, LibSkeletonState> {
|
|
22
|
+
constructor(props: LibSkeletonProps) {
|
|
23
|
+
super(props);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static BoxFull(props: LibSkeletonStatic): any {
|
|
27
|
+
return <View style={{ margin: '2.5%', marginVertical: 8, alignSelf: 'center', backgroundColor: 'black', height: props.size, width: '95%', borderRadius: 10 }} />
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static BoxFlex(props: LibSkeletonStatic): any {
|
|
31
|
+
return (<View style={{ margin: '2.5%', marginVertical: 8, backgroundColor: 'black', flexGrow: 1, height: props.size, borderRadius: 10 }} />)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static BoxHalf(props: LibSkeletonStatic): any {
|
|
35
|
+
return <View style={{ margin: '2.5%', marginVertical: 8, backgroundColor: 'black', height: props.size, width: '45%', borderRadius: 10 }} />
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static Box(props: LibSkeletonStatic): any {
|
|
39
|
+
return <View style={{ margin: '2.5%', marginVertical: 8, backgroundColor: 'black', height: props.size, width: props.size, borderRadius: 10 }} />
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static Circle(props: LibSkeletonStatic): any {
|
|
43
|
+
return <View style={{ margin: '2.5%', marginVertical: 8, backgroundColor: 'black', height: props.size, width: props.size, borderRadius: props.size * 0.5 }} />
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
render(): any {
|
|
47
|
+
return (
|
|
48
|
+
<Skeleton {...this.props} />
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface LibSkeletonArgs {
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
export interface LibSkeletonProps {
|
|
57
|
+
duration?: number
|
|
58
|
+
reverse?: boolean,
|
|
59
|
+
colors?: string[],
|
|
60
|
+
backgroundStyle?: any,
|
|
61
|
+
children?: any
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient)
|
|
65
|
+
function Skeleton(props: LibSkeletonProps): any {
|
|
66
|
+
const offset = useSharedValue(-LibStyle.width * 0.75)
|
|
67
|
+
|
|
68
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
69
|
+
return {
|
|
70
|
+
transform: [{ translateX: offset.value }]
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
offset.value = -LibStyle.width * 0.75
|
|
76
|
+
offset.value = withRepeat(withTiming(LibStyle.width * 0.5, { duration: props.duration || 1000 }), -1, props.reverse ?? false)
|
|
77
|
+
}, [])
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<View style={[{ flex: 1 }, props?.backgroundStyle]} >
|
|
82
|
+
<MaskedView
|
|
83
|
+
style={{ flex: 1 }}
|
|
84
|
+
maskElement={
|
|
85
|
+
props.children ?
|
|
86
|
+
<View style={{ flex: 1 }} >
|
|
87
|
+
{props.children}
|
|
88
|
+
</View>
|
|
89
|
+
:
|
|
90
|
+
<View style={{ flex: 1, justifyContent: 'center' }} >
|
|
91
|
+
<View>
|
|
92
|
+
<View style={{ marginTop: 24, backgroundColor: 'black', height: LibStyle.width * 9 / 16, width: LibStyle.width }} >
|
|
93
|
+
</View>
|
|
94
|
+
</View>
|
|
95
|
+
</View>
|
|
96
|
+
}>
|
|
97
|
+
<AnimatedLinearGradient
|
|
98
|
+
style={[{ height: '100%', width: LibStyle.width * 3.5, alignSelf: 'center', }, animatedStyle]}
|
|
99
|
+
colors={props.colors ?? ['#f1f2f3', '#f1f2f3', '#f1f2f3', '#f1f2f3', '#f1f2f3', '#f1f2f3', '#dedede', '#f1f2f3', '#f1f2f3', '#f1f2f3', '#f1f2f3', '#f1f2f3', '#f1f2f3']}
|
|
100
|
+
start={{ x: 0, y: 1 }}
|
|
101
|
+
end={{ x: 1, y: 1 }}
|
|
102
|
+
/>
|
|
103
|
+
</MaskedView>
|
|
104
|
+
</View>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
@@ -34,14 +34,16 @@ export default class m extends LibComponent<LibSlidingupProps, LibSlidingupState
|
|
|
34
34
|
} else if (prevState.show == true && this.state.show == false) {
|
|
35
35
|
BackHandler.removeEventListener("hardwareBackPress", this.handleBack)
|
|
36
36
|
this.props?.onChangeShow?.(this.state.show)
|
|
37
|
-
}
|
|
37
|
+
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
show(): void {
|
|
41
41
|
Keyboard.dismiss()
|
|
42
42
|
if (this.props.children) {
|
|
43
43
|
this.setState({ show: true }, () => {
|
|
44
|
-
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
this._toggleSubview(true)
|
|
46
|
+
}, 1);
|
|
45
47
|
})
|
|
46
48
|
}
|
|
47
49
|
}
|
package/modules/lib/tabs.tsx
CHANGED
|
@@ -86,6 +86,7 @@ export default class m extends LibComponent<LibTabsProps, LibTabsState> {
|
|
|
86
86
|
horizontal
|
|
87
87
|
showsHorizontalScrollIndicator={false}
|
|
88
88
|
scrollEnabled={!!this.props.swipeEnabled}
|
|
89
|
+
nestedScrollEnabled
|
|
89
90
|
scrollEventThrottle={16}
|
|
90
91
|
onScroll={this.changePage}
|
|
91
92
|
pagingEnabled
|
package/modules/lib/utils.ts
CHANGED
|
@@ -3,7 +3,7 @@ import moment from "../../moment"
|
|
|
3
3
|
import { Linking, Platform, Share } from "react-native"
|
|
4
4
|
import { esp, LibToastProperty, _global, createCache } from "esoftplay"
|
|
5
5
|
import shorthash from "shorthash"
|
|
6
|
-
import Clipboard from 'expo-clipboard'
|
|
6
|
+
import * as Clipboard from 'expo-clipboard';
|
|
7
7
|
const Buffer = require('buffer/').Buffer
|
|
8
8
|
const isEqual = require("react-fast-compare");
|
|
9
9
|
|
package/modules/lib/version.tsx
CHANGED
|
@@ -14,7 +14,7 @@ export interface LibVersionState {
|
|
|
14
14
|
export default class m extends LibComponent<LibVersionProps, LibVersionState> {
|
|
15
15
|
|
|
16
16
|
static appVersion(): string {
|
|
17
|
-
let version: any = Constants.
|
|
17
|
+
let version: any = (Platform.OS == 'android' ? Constants.manifest.android.versionCode : Constants.manifest.ios.buildNumber)
|
|
18
18
|
return version
|
|
19
19
|
}
|
|
20
20
|
|
package/modules/user/index.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
|
|
3
|
-
import React, { useEffect, useMemo
|
|
3
|
+
import React, { useEffect, useMemo } from "react";
|
|
4
4
|
//@ts-ignore
|
|
5
5
|
import Navs from "../../cache/navs";
|
|
6
|
-
import { View
|
|
6
|
+
import { View } from "react-native";
|
|
7
7
|
import * as Font from "expo-font";
|
|
8
|
-
import { esp, _global, UserClass, LibWorker, UseDeeplink, LibUpdaterProperty, LibWorkloop, LibNet_status, LibDialog, LibStyle, LibImage, LibProgress, UserMain, LibToast, useSafeState, LibVersion, UserRoutes, LibWorkview } from 'esoftplay';
|
|
8
|
+
import { esp, _global, UserClass, LibWorker, UseDeeplink, LibUpdaterProperty, LibWorkloop, LibNet_status, LibDialog, LibStyle, LibImage, LibProgress, UserLoading, UserMain, LibToast, useSafeState, LibVersion, UserRoutes, LibWorkview } from 'esoftplay';
|
|
9
9
|
import firebase from 'firebase';
|
|
10
10
|
|
|
11
11
|
export interface UserIndexProps {
|
|
@@ -33,11 +33,12 @@ function setFonts(): Promise<void> {
|
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
|
|
36
37
|
export default function m(props: UserIndexProps): any {
|
|
37
38
|
const [loading, setLoading] = useSafeState(true)
|
|
38
39
|
const user = UserClass.state().useSelector(s => s)
|
|
39
|
-
//@ts-ignore
|
|
40
40
|
UseDeeplink()
|
|
41
|
+
//@ts-ignore
|
|
41
42
|
const initialState = __DEV__ ? _global.nav__state : undefined
|
|
42
43
|
|
|
43
44
|
function handler(currentState: any): void {
|
|
@@ -50,18 +51,10 @@ export default function m(props: UserIndexProps): any {
|
|
|
50
51
|
|
|
51
52
|
useMemo(() => {
|
|
52
53
|
if (esp.config('firebase')) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
console.warn(error)
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
firebase.auth().signInAnonymously()
|
|
61
|
-
} catch (error) {
|
|
62
|
-
console.warn(error)
|
|
63
|
-
}
|
|
64
|
-
})
|
|
54
|
+
if (!firebase.apps.length) {
|
|
55
|
+
firebase.initializeApp(esp.config('firebase'));
|
|
56
|
+
firebase.auth().signInAnonymously()
|
|
57
|
+
}
|
|
65
58
|
}
|
|
66
59
|
UserClass.isLogin(async () => {
|
|
67
60
|
await setFonts()
|
|
@@ -83,7 +76,7 @@ export default function m(props: UserIndexProps): any {
|
|
|
83
76
|
}
|
|
84
77
|
}, [loading])
|
|
85
78
|
|
|
86
|
-
if (loading) return <
|
|
79
|
+
if (loading) return <UserLoading />
|
|
87
80
|
return (
|
|
88
81
|
<>
|
|
89
82
|
<View style={{ flex: 1 }}>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { ImageBackground } from "react-native";
|
|
5
|
+
import { esp } from 'esoftplay'
|
|
6
|
+
|
|
7
|
+
export interface UserLoadingArgs {
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
export interface UserLoadingProps {
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
export default function m(props: UserLoadingProps): any {
|
|
14
|
+
return <ImageBackground source={esp.assets('splash.gif') || esp.assets('splash.png')} style={{ flex: 1 }} />
|
|
15
|
+
}
|
package/moment.ts
CHANGED
|
@@ -4,6 +4,8 @@ import dayjs from 'dayjs'
|
|
|
4
4
|
const utc = require('dayjs/plugin/utc')
|
|
5
5
|
const timezone = require('dayjs/plugin/timezone') // dependent on utc plugin
|
|
6
6
|
const relativeTime = require('dayjs/plugin/relativeTime')
|
|
7
|
+
var duration = require('dayjs/plugin/duration')
|
|
8
|
+
dayjs.extend(duration)
|
|
7
9
|
dayjs.extend(utc)
|
|
8
10
|
dayjs.extend(timezone)
|
|
9
11
|
dayjs.extend(relativeTime)
|
|
@@ -49,10 +51,15 @@ export default function moment(date?: string | Date | any) {
|
|
|
49
51
|
const out = dayjs(_date).toDate()
|
|
50
52
|
return out
|
|
51
53
|
},
|
|
52
|
-
|
|
54
|
+
toMiliseconds: () => {
|
|
53
55
|
const out = String(dayjs(_date).valueOf())
|
|
54
56
|
return out
|
|
55
|
-
}
|
|
57
|
+
},
|
|
58
|
+
duration: (other_date: string | Date) => {
|
|
59
|
+
const x = dayjs(_date)
|
|
60
|
+
const y = dayjs(other_date)
|
|
61
|
+
return dayjs.duration(x.diff(y))
|
|
62
|
+
},
|
|
56
63
|
}
|
|
57
64
|
}
|
|
58
65
|
|
package/package.json
CHANGED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// withHooks
|
|
2
|
-
|
|
3
|
-
import React, { useEffect } from 'react';
|
|
4
|
-
import { View, Image } from 'react-native';
|
|
5
|
-
//@ts-ignore
|
|
6
|
-
import { ImageManipulator } from 'expo-image-crop'
|
|
7
|
-
import { LibUtils, LibNavigation, useSafeState } from 'esoftplay';
|
|
8
|
-
|
|
9
|
-
export interface LibImage_editProps {
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
export default function m(props: LibImage_editProps): any {
|
|
13
|
-
const { uri } = LibUtils.getArgsAll(props)
|
|
14
|
-
const [show, setShow] = useSafeState(true)
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
return () => LibNavigation.cancelBackResult(LibNavigation.getResultKey(props))
|
|
18
|
-
}, [])
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<View style={{ flex: 1, backgroundColor: "#000", position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, zIndex: 9999, elevation: 10 }} >
|
|
22
|
-
<ImageManipulator
|
|
23
|
-
photo={{ uri }}
|
|
24
|
-
isVisible={show}
|
|
25
|
-
onPictureChoosed={(x: any) => {
|
|
26
|
-
Image.getSize(x.uri, (width, height) => {
|
|
27
|
-
LibNavigation.sendBackResult({ uri: x.uri, width, height }, LibNavigation.getResultKey(props))
|
|
28
|
-
}, () => { })
|
|
29
|
-
}}
|
|
30
|
-
onToggleModal={() => {
|
|
31
|
-
setShow(!show)
|
|
32
|
-
LibNavigation.back()
|
|
33
|
-
}}
|
|
34
|
-
/>
|
|
35
|
-
</View>
|
|
36
|
-
)
|
|
37
|
-
}
|