@aks-dev/easyui 1.0.84 → 1.0.87
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.
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-24 14:27:02
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
6
|
-
* @FilePath: /@aks/easyui/lib/
|
|
5
|
+
* @LastEditTime: 2022-07-15 14:21:00
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/Hud/Loading/Loading.tsx
|
|
7
7
|
*/
|
|
8
8
|
import React, { useImperativeHandle, useState } from 'react';
|
|
9
|
-
import { View, ActivityIndicator, StyleSheet, Text, Dimensions,TouchableOpacity } from 'react-native';
|
|
9
|
+
import { View, ActivityIndicator, StyleSheet, Text, Dimensions, TouchableOpacity, BackHandler } from 'react-native';
|
|
10
10
|
|
|
11
11
|
import type { LoadingCurrent } from '.'
|
|
12
12
|
|
|
@@ -19,6 +19,13 @@ export const Loading = React.forwardRef<LoadingCurrent, {}>((_, ref) => {
|
|
|
19
19
|
const [tipText, setTipText] = useState('加载中');
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
const onBackPress = () => show;
|
|
24
|
+
BackHandler.addEventListener('hardwareBackPress', onBackPress);
|
|
25
|
+
return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
|
|
26
|
+
}, [show])
|
|
27
|
+
|
|
28
|
+
|
|
22
29
|
useImperativeHandle<unknown, LoadingCurrent>(ref, () => ({
|
|
23
30
|
showLoading: (content?: string) => {
|
|
24
31
|
setShow(true);
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-24 14:27:02
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-07-15
|
|
5
|
+
* @LastEditTime: 2022-07-15 14:20:40
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/lib/Hud/PopoverView/PopoverView.tsx
|
|
7
7
|
*/
|
|
8
8
|
import React, { useImperativeHandle, useState } from 'react';
|
|
9
|
-
import { StyleSheet, TouchableOpacity } from 'react-native';
|
|
9
|
+
import { StyleSheet, TouchableOpacity, BackHandler } from 'react-native';
|
|
10
10
|
import type { PopoverViewCurrent, PopoverViewOptions } from '.';
|
|
11
11
|
|
|
12
12
|
|
|
@@ -18,6 +18,12 @@ export const PopoverView = React.forwardRef<PopoverViewCurrent, {}>((_, ref) =>
|
|
|
18
18
|
const [visible, setVisible] = useState<boolean>(false);
|
|
19
19
|
const [options, setOptions] = useState<Partial<PopoverViewOptions> | undefined>()
|
|
20
20
|
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
const onBackPress = () => visible;
|
|
23
|
+
BackHandler.addEventListener('hardwareBackPress', onBackPress);
|
|
24
|
+
return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
|
|
25
|
+
}, [visible])
|
|
26
|
+
|
|
21
27
|
|
|
22
28
|
useImperativeHandle<unknown, PopoverViewCurrent>(ref, () => ({
|
|
23
29
|
showPopoverView: (options: Partial<PopoverViewOptions>) => {
|
|
@@ -35,7 +41,7 @@ export const PopoverView = React.forwardRef<PopoverViewCurrent, {}>((_, ref) =>
|
|
|
35
41
|
return null;
|
|
36
42
|
|
|
37
43
|
return (
|
|
38
|
-
<TouchableOpacity activeOpacity={1}
|
|
44
|
+
<TouchableOpacity activeOpacity={1} style={[styles.container, options?.style]} onPress={e => {
|
|
39
45
|
setVisible(false);
|
|
40
46
|
setOptions(undefined)
|
|
41
47
|
// e.stopPropagation()
|
|
@@ -104,7 +104,7 @@ export default (props: MenuProps) => {
|
|
|
104
104
|
target_height,
|
|
105
105
|
} = getLayoutInfos()
|
|
106
106
|
|
|
107
|
-
const
|
|
107
|
+
const layout = () => {
|
|
108
108
|
if (alignHorizontal == 'left') {
|
|
109
109
|
if (target_width + x > deviceWidth) {
|
|
110
110
|
return {
|
|
@@ -132,17 +132,17 @@ export default (props: MenuProps) => {
|
|
|
132
132
|
}
|
|
133
133
|
if (alignVertical == 'bottom') {
|
|
134
134
|
y = y + 10
|
|
135
|
-
return
|
|
135
|
+
return layout()
|
|
136
136
|
} else {
|
|
137
137
|
y = (StatusBar.currentHeight || 0) + _container.current.y - target_height - 10
|
|
138
|
-
return
|
|
138
|
+
return layout()
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
|
|
143
143
|
const show = () => {
|
|
144
144
|
// console.log('_container', _container.current, StatusBar.currentHeight)
|
|
145
|
-
if(props.data == undefined || props.data?.length == 0) return
|
|
145
|
+
if (props.data == undefined || props.data?.length == 0) return
|
|
146
146
|
showPopoverView({
|
|
147
147
|
content: (
|
|
148
148
|
<TouchableOpacity
|
package/package.json
CHANGED
package/screen/px2sp.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2021-04-27 10:40:36
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-07-18 11:27:22
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/screen/px2sp.ts
|
|
7
|
+
*/
|
|
1
8
|
import { Dimensions, PixelRatio } from 'react-native';
|
|
2
9
|
const pixelRatio = PixelRatio.get();
|
|
3
10
|
const width = Dimensions.get('window').width; //设备的宽度
|
|
@@ -54,7 +61,8 @@ export const px2sp = (size: number) => {
|
|
|
54
61
|
return size * 1.25;
|
|
55
62
|
}
|
|
56
63
|
// catch larger phablet devices
|
|
57
|
-
|
|
64
|
+
|
|
65
|
+
return size * 1.3;
|
|
58
66
|
}
|
|
59
67
|
// if older device ie pixelRatio !== 2 || 3 || 3.5
|
|
60
68
|
return size;
|