esoftplay 0.0.141-e → 0.0.141-g
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/error.ts +3 -3
- package/modules/lib/image.tsx +13 -12
- package/modules/lib/keyboard_avoid.tsx +4 -62
- package/modules/lib/picture.tsx +9 -8
- package/package.json +1 -1
package/error.ts
CHANGED
|
@@ -14,12 +14,12 @@ function getTime() {
|
|
|
14
14
|
const isoStringWithGMTPlus7 = new Date(adjustedDate).toISOString();
|
|
15
15
|
return isoStringWithGMTPlus7.replace('T', ' ').replace(/\.[0-9]+Z/g, "")
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
const defaultErrorHandler = ErrorUtils?.getGlobalHandler?.()
|
|
18
18
|
|
|
19
19
|
const myErrorHandler = (e: any, isFatal: any) => {
|
|
20
20
|
if (!expoConfig?.packagerOpts)
|
|
21
21
|
setError(e)
|
|
22
|
-
|
|
22
|
+
defaultErrorHandler?.(e, isFatal)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export function setError(error?: any) {
|
|
@@ -140,4 +140,4 @@ export function getError() {
|
|
|
140
140
|
}
|
|
141
141
|
})
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
ErrorUtils.setGlobalHandler(myErrorHandler)
|
package/modules/lib/image.tsx
CHANGED
|
@@ -7,7 +7,8 @@ import { LibProgress } from 'esoftplay/cache/lib/progress/import';
|
|
|
7
7
|
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
8
8
|
import esp from 'esoftplay/esp';
|
|
9
9
|
import useGlobalState from 'esoftplay/global';
|
|
10
|
-
import {
|
|
10
|
+
import { CameraView } from 'expo-camera';
|
|
11
|
+
import { CameraType } from 'expo-camera/build/legacy/Camera.types';
|
|
11
12
|
import * as ImageManipulator from 'expo-image-manipulator';
|
|
12
13
|
import { SaveFormat } from 'expo-image-manipulator';
|
|
13
14
|
import * as ImagePicker from 'expo-image-picker';
|
|
@@ -80,7 +81,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
80
81
|
constructor(props: LibImageProps) {
|
|
81
82
|
super(props);
|
|
82
83
|
this.state = {
|
|
83
|
-
type:
|
|
84
|
+
type: CameraType.back,
|
|
84
85
|
loading: false,
|
|
85
86
|
image: null,
|
|
86
87
|
flashLight: 'off'
|
|
@@ -302,17 +303,17 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
302
303
|
return (
|
|
303
304
|
<View style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }} >
|
|
304
305
|
<View style={{ flex: 1 }} >
|
|
305
|
-
<
|
|
306
|
+
<CameraView
|
|
306
307
|
ref={(camera: any) => this.camera = camera}
|
|
307
|
-
|
|
308
|
+
facing={type}
|
|
308
309
|
ratio={'4:3'}
|
|
309
|
-
|
|
310
|
+
flash={flashLight}
|
|
310
311
|
zoom={0.1}
|
|
311
312
|
style={{ height: LibStyle.width * 4 / 3, width: LibStyle.width }}>
|
|
312
313
|
<View style={{ height: height, width: width, backgroundColor: 'transparent' }} >
|
|
313
|
-
{image ? <Image source={image} style={{ height: LibStyle.width * 4 / 3, width: width, resizeMode: 'cover', transform: [{ scaleX: this.state.type ==
|
|
314
|
+
{image ? <Image source={image} style={{ height: LibStyle.width * 4 / 3, width: width, resizeMode: 'cover', transform: [{ scaleX: this.state.type == CameraType.back ? CameraType.front : CameraType.back }] }} /> : null}
|
|
314
315
|
</View>
|
|
315
|
-
</
|
|
316
|
+
</CameraView>
|
|
316
317
|
<View style={{ position: 'absolute', top: 10 + LibStyle.STATUSBAR_HEIGHT, left: 10 }} >
|
|
317
318
|
<TouchableOpacity onPress={() => this.setState({ flashLight: flashLight == 'on' ? 'off' : 'on' })} >
|
|
318
319
|
<LibIcon color={'white'} size={24} name={flashLight == 'on' ? 'flash' : "flash-off"} />
|
|
@@ -324,11 +325,11 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
324
325
|
{
|
|
325
326
|
image ?
|
|
326
327
|
<TouchableOpacity onPress={() => this.setState({ image: false })} >
|
|
327
|
-
<LibIcon.Ionicons name='
|
|
328
|
+
<LibIcon.Ionicons name='close-circle' style={{ fontSize: 40, color: 'white' }} />
|
|
328
329
|
</TouchableOpacity>
|
|
329
330
|
:
|
|
330
|
-
<TouchableOpacity onPress={() => this.setState({ type: this.state.type ===
|
|
331
|
-
<LibIcon.Ionicons name='
|
|
331
|
+
<TouchableOpacity onPress={() => this.setState({ type: this.state.type === CameraType.back ? CameraType.front : CameraType.back })} >
|
|
332
|
+
<LibIcon.Ionicons name='refresh-circle' style={{ fontSize: 40, color: 'white' }} />
|
|
332
333
|
</TouchableOpacity>
|
|
333
334
|
}
|
|
334
335
|
</View>
|
|
@@ -358,7 +359,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
358
359
|
clearTimeout(timer)
|
|
359
360
|
});
|
|
360
361
|
}} >
|
|
361
|
-
<LibIcon.Ionicons name='
|
|
362
|
+
<LibIcon.Ionicons name='checkmark-circle' style={{ fontSize: 40, color: 'white' }} />
|
|
362
363
|
</TouchableOpacity>
|
|
363
364
|
:
|
|
364
365
|
<TouchableOpacity onPress={() => {
|
|
@@ -369,7 +370,7 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
369
370
|
});
|
|
370
371
|
clearTimeout(timer)
|
|
371
372
|
}} >
|
|
372
|
-
<LibIcon.Ionicons name='
|
|
373
|
+
<LibIcon.Ionicons name='close-circle' style={{ fontSize: 40, color: 'white' }} />
|
|
373
374
|
</TouchableOpacity>
|
|
374
375
|
}
|
|
375
376
|
</View>
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
// noPage
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import React, { useRef, useState } from 'react';
|
|
8
|
-
import { KeyboardAvoidingView, Platform, ViewStyle } from 'react-native';
|
|
9
|
-
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Platform, ViewStyle } from 'react-native';
|
|
6
|
+
import { KeyboardAvoidingView } from 'react-native-keyboard-controller';
|
|
10
7
|
|
|
11
8
|
export interface LibKeyboard_avoidProps {
|
|
12
9
|
children?: any,
|
|
13
10
|
style?: ViewStyle
|
|
14
11
|
}
|
|
15
|
-
export default function m(props: LibKeyboard_avoidProps): any {
|
|
16
|
-
|
|
17
|
-
// const isFocussed = useIsFocused();
|
|
18
12
|
|
|
19
|
-
// const Custom = isFocussed ? KeyboardAvoidingView : View
|
|
20
13
|
|
|
14
|
+
export default function m(props: LibKeyboard_avoidProps): any {
|
|
21
15
|
return (
|
|
22
16
|
<KeyboardAvoidingView behavior={Platform.OS == 'android' ? 'height' : 'padding'} style={[{ flex: 1 }, props.style]} >
|
|
23
17
|
{props.children}
|
|
@@ -25,55 +19,3 @@ export default function m(props: LibKeyboard_avoidProps): any {
|
|
|
25
19
|
)
|
|
26
20
|
}
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Hook to access the navigation prop of the parent screen anywhere.
|
|
31
|
-
*
|
|
32
|
-
* @returns Navigation prop of the parent screen.
|
|
33
|
-
*/
|
|
34
|
-
function useNavigation<T = NavigationProp<ReactNavigation.RootParamList>>(): T {
|
|
35
|
-
const root = React.useContext(NavigationContainerRefContext);
|
|
36
|
-
const navigation = React.useContext(NavigationContext);
|
|
37
|
-
|
|
38
|
-
if (navigation === undefined && root === undefined) {
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
return (navigation ?? root) as unknown as T;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function useIsFocused(): boolean {
|
|
45
|
-
const navigation = useNavigation();
|
|
46
|
-
|
|
47
|
-
const forceTrue = useRef(false)
|
|
48
|
-
|
|
49
|
-
if (navigation == undefined) {
|
|
50
|
-
forceTrue.current = true
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const [isFocused, setIsFocused] = useState(navigation?.isFocused);
|
|
54
|
-
|
|
55
|
-
const valueToReturn = !!navigation?.isFocused?.();
|
|
56
|
-
|
|
57
|
-
if (isFocused !== valueToReturn) {
|
|
58
|
-
setIsFocused(valueToReturn);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
React.useEffect(() => {
|
|
62
|
-
const unsubscribeFocus = navigation?.addListener?.('focus', () =>
|
|
63
|
-
setIsFocused(true)
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const unsubscribeBlur = navigation?.addListener?.('blur', () =>
|
|
67
|
-
setIsFocused(false)
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
return () => {
|
|
71
|
-
unsubscribeFocus?.();
|
|
72
|
-
unsubscribeBlur?.();
|
|
73
|
-
};
|
|
74
|
-
}, [navigation]);
|
|
75
|
-
|
|
76
|
-
React.useDebugValue(valueToReturn);
|
|
77
|
-
|
|
78
|
-
return (forceTrue.current || valueToReturn);
|
|
79
|
-
}
|
package/modules/lib/picture.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
// noPage
|
|
3
|
+
import { Image } from 'expo-image';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { ImageStyle } from 'react-native';
|
|
5
|
-
import FastImage from 'react-native-fast-image';
|
|
6
6
|
|
|
7
7
|
export interface LibPictureSource {
|
|
8
8
|
uri: string
|
|
@@ -11,7 +11,6 @@ export interface LibPictureProps {
|
|
|
11
11
|
source: LibPictureSource | any,
|
|
12
12
|
style: ImageStyle,
|
|
13
13
|
resizeMode?: "contain" | "cover",
|
|
14
|
-
noCache?: boolean,
|
|
15
14
|
onError?: () => void,
|
|
16
15
|
}
|
|
17
16
|
|
|
@@ -19,15 +18,17 @@ export default function m(props: LibPictureProps): any {
|
|
|
19
18
|
|
|
20
19
|
let resizeMode
|
|
21
20
|
if (props?.style?.resizeMode == 'cover')
|
|
22
|
-
resizeMode =
|
|
21
|
+
resizeMode = "cover"
|
|
23
22
|
else if (props?.style?.resizeMode == 'contain')
|
|
24
|
-
resizeMode =
|
|
23
|
+
resizeMode = "contain"
|
|
25
24
|
else if (props?.resizeMode == 'cover')
|
|
26
|
-
resizeMode =
|
|
25
|
+
resizeMode = "cover"
|
|
27
26
|
else if (props?.resizeMode == 'contain')
|
|
28
|
-
resizeMode =
|
|
27
|
+
resizeMode = "contain"
|
|
29
28
|
else
|
|
30
|
-
resizeMode =
|
|
29
|
+
resizeMode = "cover"
|
|
31
30
|
|
|
32
|
-
return
|
|
31
|
+
return (
|
|
32
|
+
<Image {...props} contentFit={resizeMode} allowDownscaling cachePolicy={"disk"} />
|
|
33
|
+
)
|
|
33
34
|
}
|