@aks-dev/easyui 1.0.133 → 1.0.134

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.
@@ -1,10 +1,10 @@
1
1
  import React from "react";
2
- import { Image, LayoutRectangle, MeasureInWindowOnSuccessCallback, ScrollView, StatusBar, Text, TouchableOpacity, View } from 'react-native';
2
+ import { Image, LayoutRectangle, MeasureOnSuccessCallback, ScrollView, StatusBar, Text, TouchableOpacity, View } from 'react-native';
3
3
  import type { MenuProps } from '.';
4
4
  import { deviceHeight, deviceWidth } from '../../screen/px2dp';
5
+ import * as utils from '../../utils/lazy';
5
6
  import { hidePopoverView, showPopoverView } from '../Hud/Hud';
6
7
 
7
-
8
8
  type State = {
9
9
  target?: LayoutRectangle;
10
10
  arrow?: Partial<{
@@ -24,7 +24,8 @@ export default (props: MenuProps) => {
24
24
 
25
25
  const [state, dispatch] = React.useReducer<Reducer>((prevState, action) => Object.assign({}, prevState, action), {})
26
26
 
27
- const containerRef = React.useRef<{ measureInWindow: (callback: MeasureInWindowOnSuccessCallback) => void }>()
27
+ // const containerRef = React.useRef<{ measureInWindow: (callback: MeasureInWindowOnSuccessCallback) => void }>()
28
+ const containerRef = React.useRef<{ measure: (callback: MeasureOnSuccessCallback) => void }>()
28
29
  const _container = React.useRef<{
29
30
  x: number;
30
31
  y: number;
@@ -34,19 +35,21 @@ export default (props: MenuProps) => {
34
35
 
35
36
 
36
37
  React.useEffect(() => {
37
- containerRef.current?.measureInWindow((...args) => {
38
- // console.log('containerRef', args)
39
- if (args.length == 4) {
40
- _container.current = {
41
- x: args[0],
42
- y: args[1],
43
- width: args[2],
44
- height: args[3],
38
+ ;(async ()=>{
39
+ await utils.sleep()
40
+ containerRef.current?.measure((...args) => {
41
+ // console.log('containerRef', args)
42
+ if (args.length == 6) {
43
+ _container.current = {
44
+ x: args[4],
45
+ y: args[5],
46
+ width: args[2],
47
+ height: args[3],
48
+ }
45
49
  }
46
- }
47
- })
48
-
49
- })
50
+ })
51
+ })()
52
+ },[])
50
53
 
51
54
 
52
55
  const getLayoutInfos: () => {
@@ -65,7 +68,8 @@ export default (props: MenuProps) => {
65
68
  let width = _container.current.width
66
69
  let height = _container.current.height
67
70
  let x = _container.current.x
68
- let y = (StatusBar.currentHeight || 0) + _container.current.y + height
71
+ // let y = (StatusBar.currentHeight || 0) + _container.current.y + height
72
+ let y = _container.current.y + height
69
73
  if (x > Math.abs(deviceWidth - width - x)) {
70
74
  alignHorizontal = 'right'
71
75
  }
@@ -2,7 +2,7 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-07-14 18:09:02
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-07-21 16:08:43
5
+ * @LastEditTime: 2022-12-22 22:38:52
6
6
  * @FilePath: /@aks-dev/easyui/lib/MenuView/index.ts
7
7
  */
8
8
 
@@ -18,6 +18,7 @@ export type MenuItem = {
18
18
  }
19
19
 
20
20
  export type MenuProps = {
21
+ activeOpacity?: number | undefined;
21
22
  style?: StyleProp<ViewStyle> | undefined;
22
23
  data?: MenuItem[];
23
24
  onItemClick?: (index: number, extra?: any) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aks-dev/easyui",
3
- "version": "1.0.133",
3
+ "version": "1.0.134",
4
4
  "description": "工具箱",
5
5
  "main": "./src/index.ts",
6
6
  "typings": "./src/index.d.ts",