-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathUIMenuNativeComponent.ts
More file actions
67 lines (64 loc) · 1.79 KB
/
UIMenuNativeComponent.ts
File metadata and controls
67 lines (64 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import type {
DirectEventHandler,
Int32,
} from "react-native/Libraries/Types/CodegenTypes";
import type { HostComponent, ViewProps } from "react-native";
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
/*
Caution, those below are not just typescript types.
Codegen is using them to create the corresponding C++ data types.
Codegen doesn't play very well with reusing the same type within a type,
OR with extending types in an interface, so for now we'll just keep some duplicate
types here, to avoid issues while `pod install` takes place.
*/
type SubAction = {
id?: string;
title: string;
titleColor?: Int32;
subtitle?: string;
state?: string;
image?: string;
imageColor?: Int32;
displayInline?: boolean;
attributes?: {
destructive?: boolean;
disabled?: boolean;
hidden?: boolean;
};
};
type MenuAction = {
id?: string;
title: string;
titleColor?: Int32;
subtitle?: string;
state?: string;
image?: string;
imageColor?: Int32;
displayInline?: boolean;
attributes?: {
destructive?: boolean;
disabled?: boolean;
hidden?: boolean;
};
subactions?: Array<SubAction>;
};
export interface NativeProps extends ViewProps {
onPressAction?: DirectEventHandler<{ event: string }>;
onCloseMenu?: DirectEventHandler<{ event: string }>;
onOpenMenu?: DirectEventHandler<{ event: string }>;
actions: Array<MenuAction>;
actionsHash: string; // just a workaround to make sure we don't have to manually compare MenuActions manually in C++ (since it's a struct and that's a pain)
title?: string;
themeVariant?: string;
uiKit?: string;
shouldOpenOnLongPress?: boolean;
hitSlop: {
top: Int32;
bottom: Int32;
left: Int32;
right: Int32;
};
}
export default codegenNativeComponent<NativeProps>(
"MenuView",
) as HostComponent<NativeProps>;