forked from dominicstop/react-native-ios-context-menu
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MenuEvents.ts
112 lines (84 loc) · 2.69 KB
/
MenuEvents.ts
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import type { NativeSyntheticEvent } from 'react-native';
import type { MenuActionConfig } from '../types/MenuConfig';
// Event Object Types
// ------------------
export type OnMenuWillShowEventObject = NativeSyntheticEvent<{
}>;
export type OnMenuWillHideEventObject = NativeSyntheticEvent<{
}>;
export type OnMenuDidShowEventObject = NativeSyntheticEvent<{
}>;
export type OnMenuDidHideEventObject = NativeSyntheticEvent<{
}>;
export type OnMenuWillCancelEventObject = NativeSyntheticEvent<{
}>;
export type OnMenuDidCancelEventObject = NativeSyntheticEvent<{}> & {
isUsingActionSheetFallback?: false;
} | {
isUsingActionSheetFallback: true;
};
export type OnMenuWillCreateEventObject = NativeSyntheticEvent<{
}>;
export type OnRequestDeferredElementObject = NativeSyntheticEvent<{
deferredID: string;
}>;
export type OnPressMenuItemEventObject = NativeSyntheticEvent<MenuActionConfig> & {
isUsingActionSheetFallback?: false;
} | {
isUsingActionSheetFallback: true;
nativeEvent: MenuActionConfig;
};
export type OnPressMenuPreviewEventObject = NativeSyntheticEvent<{
}>;
export type MenuAuxiliaryPreviewDetailsEventObject = {
size: {
width: number;
height: number;
};
menuHasItems: boolean;
menuItemsPlacement: 'top' | 'bottom' | 'unknown';
previewPosition: 'top' | 'bottom';
isAuxiliaryPreviewAttachedToTop: boolean;
};
export type OnMenuAuxiliaryPreviewWillShowEventObject =
NativeSyntheticEvent<MenuAuxiliaryPreviewDetailsEventObject>;
export type OnMenuAuxiliaryPreviewDidShowEventObject =
NativeSyntheticEvent<MenuAuxiliaryPreviewDetailsEventObject>;
// Event Handler Types
// -------------------
export type OnMenuWillShowEvent = (
event: OnMenuWillShowEventObject
) => void;
export type OnMenuWillHideEvent = (
event: OnMenuWillHideEventObject
) => void;
export type OnMenuDidShowEvent = (
event: OnMenuDidShowEventObject
) => void;
export type OnMenuDidHideEvent = (
event: OnMenuDidHideEventObject
) => void;
export type OnMenuWillCancelEvent = (
event: OnMenuWillCancelEventObject
) => void;
export type OnMenuDidCancelEvent = (
event: OnMenuDidCancelEventObject
) => void;
export type OnMenuWillCreateEvent = (
event: OnMenuWillCreateEventObject
) => void;
export type OnRequestDeferredElementEvent = (
event: OnRequestDeferredElementObject
) => void;
export type OnPressMenuItemEvent = (
event: OnPressMenuItemEventObject
) => void;
export type OnPressMenuPreviewEvent = (
event: OnPressMenuPreviewEventObject
) => void;
export type OnMenuAuxiliaryPreviewWillShowEvent = (
event: OnMenuAuxiliaryPreviewWillShowEventObject
) => void;
export type OnMenuAuxiliaryPreviewDidShowEvent = (
event: OnMenuAuxiliaryPreviewDidShowEventObject
) => void;