@aks-dev/easyui 1.0.135 → 1.0.136
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/lib/MenuView/MenuView.tsx +10 -3
- package/lib/MenuView/index.ts +5 -4
- package/package.json +1 -1
|
@@ -22,6 +22,11 @@ type Reducer = (prevState: State, action: Partial<State>) => State
|
|
|
22
22
|
|
|
23
23
|
export default (props: MenuProps) => {
|
|
24
24
|
|
|
25
|
+
const {
|
|
26
|
+
defaultAlignHorizontal = 'left',
|
|
27
|
+
defaultAlignVertical = 'bottom'
|
|
28
|
+
} = props
|
|
29
|
+
|
|
25
30
|
const [state, dispatch] = React.useReducer<Reducer>((prevState, action) => Object.assign({}, prevState, action), {})
|
|
26
31
|
|
|
27
32
|
// const containerRef = React.useRef<{ measureInWindow: (callback: MeasureInWindowOnSuccessCallback) => void }>()
|
|
@@ -81,8 +86,8 @@ export default (props: MenuProps) => {
|
|
|
81
86
|
target_height: number;
|
|
82
87
|
}
|
|
83
88
|
= () => {
|
|
84
|
-
let alignVertical: 'bottom' | 'top' =
|
|
85
|
-
let alignHorizontal: 'left' | 'right' =
|
|
89
|
+
let alignVertical: 'bottom' | 'top' = defaultAlignVertical
|
|
90
|
+
let alignHorizontal: 'left' | 'right' = defaultAlignHorizontal
|
|
86
91
|
let width = _container.current.width
|
|
87
92
|
let height = _container.current.height
|
|
88
93
|
let x = _container.current.x
|
|
@@ -156,7 +161,8 @@ export default (props: MenuProps) => {
|
|
|
156
161
|
y = y + 10
|
|
157
162
|
return layout()
|
|
158
163
|
} else {
|
|
159
|
-
y = (StatusBar.currentHeight || 0) + _container.current.y - target_height - 10
|
|
164
|
+
// y = (StatusBar.currentHeight || 0) + _container.current.y - target_height - 10
|
|
165
|
+
y = _container.current.y - target_height - 10
|
|
160
166
|
return layout()
|
|
161
167
|
}
|
|
162
168
|
}
|
|
@@ -166,6 +172,7 @@ export default (props: MenuProps) => {
|
|
|
166
172
|
if (props.data == undefined || props.data?.length == 0) return
|
|
167
173
|
/**重新获取rootview的定位 */
|
|
168
174
|
await getRootViewlayoutPromise()
|
|
175
|
+
/**重新获取rootview的定位 */
|
|
169
176
|
showPopoverView({
|
|
170
177
|
content: (
|
|
171
178
|
<TouchableOpacity
|
package/lib/MenuView/index.ts
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-07-14 18:09:02
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-12-
|
|
5
|
+
* @LastEditTime: 2022-12-23 12:24:54
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/lib/MenuView/index.ts
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import React from "react";
|
|
10
|
-
import { ImageSourcePropType, StyleProp, ViewStyle } from 'react-native';
|
|
10
|
+
import { ImageSourcePropType, StyleProp, ViewStyle, TouchableOpacityProps } from 'react-native';
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -18,11 +18,12 @@ export type MenuItem = {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export type MenuProps = {
|
|
21
|
-
|
|
21
|
+
defaultAlignVertical?: 'bottom' | 'top';
|
|
22
|
+
defaultAlignHorizontal?: 'left' | 'right';
|
|
22
23
|
style?: StyleProp<ViewStyle> | undefined;
|
|
23
24
|
data?: MenuItem[];
|
|
24
25
|
onItemClick?: (index: number, extra?: any) => void;
|
|
25
|
-
} & Readonly<{ children?: React.ReactNode | undefined }>
|
|
26
|
+
} & Readonly<{ children?: React.ReactNode | undefined }> & TouchableOpacityProps
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
export declare const MenuView: React.FC<MenuProps>;
|