@aks-dev/easyui 1.0.134 → 1.0.135

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,7 +2,7 @@ import React from "react";
2
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
+ // import * as utils from '../../utils/lazy';
6
6
  import { hidePopoverView, showPopoverView } from '../Hud/Hud';
7
7
 
8
8
  type State = {
@@ -34,9 +34,26 @@ export default (props: MenuProps) => {
34
34
  }>({ x: 0, y: 0, width: 0, height: 0 })
35
35
 
36
36
 
37
- React.useEffect(() => {
38
- ;(async ()=>{
39
- await utils.sleep()
37
+ // React.useEffect(() => {
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
+ // }
49
+ // }
50
+ // })
51
+ // })()
52
+ // })
53
+
54
+
55
+ const getRootViewlayoutPromise = () => {
56
+ return new Promise((resovle, reject) => {
40
57
  containerRef.current?.measure((...args) => {
41
58
  // console.log('containerRef', args)
42
59
  if (args.length == 6) {
@@ -47,9 +64,10 @@ export default (props: MenuProps) => {
47
64
  height: args[3],
48
65
  }
49
66
  }
67
+ resovle(args)
50
68
  })
51
- })()
52
- },[])
69
+ })
70
+ }
53
71
 
54
72
 
55
73
  const getLayoutInfos: () => {
@@ -69,7 +87,7 @@ export default (props: MenuProps) => {
69
87
  let height = _container.current.height
70
88
  let x = _container.current.x
71
89
  // let y = (StatusBar.currentHeight || 0) + _container.current.y + height
72
- let y = _container.current.y + height
90
+ let y = _container.current.y + height
73
91
  if (x > Math.abs(deviceWidth - width - x)) {
74
92
  alignHorizontal = 'right'
75
93
  }
@@ -144,9 +162,10 @@ export default (props: MenuProps) => {
144
162
  }
145
163
 
146
164
 
147
- const show = () => {
148
- // console.log('_container', _container.current, StatusBar.currentHeight)
165
+ const show = async () => {
149
166
  if (props.data == undefined || props.data?.length == 0) return
167
+ /**重新获取rootview的定位 */
168
+ await getRootViewlayoutPromise()
150
169
  showPopoverView({
151
170
  content: (
152
171
  <TouchableOpacity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aks-dev/easyui",
3
- "version": "1.0.134",
3
+ "version": "1.0.135",
4
4
  "description": "工具箱",
5
5
  "main": "./src/index.ts",
6
6
  "typings": "./src/index.d.ts",