@aks-dev/easyui 1.0.83 → 1.0.86

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-05-12 11:33:21
6
- * @FilePath: /@aks/easyui/lib/Easy-Hud/Loading/Loading.tsx
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 12:45:52
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} style={[styles.container,options?.style]} onPress={e=>{
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 toAlignHorizontal = () => {
107
+ const layout = () => {
108
108
  if (alignHorizontal == 'left') {
109
109
  if (target_width + x > deviceWidth) {
110
110
  return {
@@ -132,16 +132,17 @@ export default (props: MenuProps) => {
132
132
  }
133
133
  if (alignVertical == 'bottom') {
134
134
  y = y + 10
135
- return toAlignHorizontal()
135
+ return layout()
136
136
  } else {
137
137
  y = (StatusBar.currentHeight || 0) + _container.current.y - target_height - 10
138
- return toAlignHorizontal()
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
146
  showPopoverView({
146
147
  content: (
147
148
  <TouchableOpacity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aks-dev/easyui",
3
- "version": "1.0.83",
3
+ "version": "1.0.86",
4
4
  "description": "移动端App开发工具包",
5
5
  "main": "./src/index.ts",
6
6
  "typings": "./src/index.d.ts",
package/readme.md CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-25 17:57:29
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-15 12:42:27
5
+ * @LastEditTime: 2022-07-15 12:47:16
6
6
  * @FilePath: /@aks-dev/easyui/README.md
7
7
  -->
8
8
 
@@ -42,7 +42,7 @@ import '@aks-dev/easyui/screen/text-fit'
42
42
  + DottedLine
43
43
  + MenuView
44
44
  + RichText
45
- ...
45
+ + ...
46
46
 
47
47
 
48
48
  ### utils