forked from dominicstop/react-native-ios-context-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenuConfig.ts
90 lines (74 loc) · 2.25 KB
/
MenuConfig.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
import type { ImageItemConfig } from "./ImageItemConfig";
import type { IconConfig } from "./MenuIconConfig";
/** Maps to `UIMenu.Options` */
// TODO: Next Major Version - Once `Enums.ts` is removed, rename back to `MenuOptions`
export type UIMenuOptions =
| 'destructive'
| 'displayInline';
/** Maps to `UIMenuElement.State` */
// TODO: Next Major Version - Rename to `MenuElementState`
export type MenuState =
| 'on'
| 'off'
| 'mixed';
/** Maps to `UIMenuElement.Attributes` */
// TODO: Next Major Version - Rename to `MenuElementAttributes`
export type MenuAttributes =
| 'hidden'
| 'disabled'
| 'destructive'
| 'keepsMenuPresented';
/** Maps to `UIMenuElement.Attributes` */
export type MenuElementSize =
| 'small'
| 'medium'
| 'large';
// Maps to `UIMenu.ElementSize`
export type DeferredMenuElementConfig = {
type: 'deferred';
deferredID: string;
shouldCache?: boolean;
};
export type MenuActionConfig = {
// TODO: Next Major Version - Make this required
type?: 'action';
actionKey: string;
actionTitle: string;
/**
* Requires iOS 15 or later.
* Text that appears below the menu action title.
*
* Previously, on iOS 13 and 14, the menu action's subtitle was set via
* `MenuActionConfig.discoverabilityTitle`.
* */
actionSubtitle?: string;
menuState?: MenuState;
menuAttributes?: Array<MenuAttributes>;
discoverabilityTitle?: string;
/**
* `IconConfig` is deprecated, use `ImageItemConfig` instead.
* Used to configure what icon or image to show in the menu action.
*/
icon?: IconConfig | ImageItemConfig;
};
export type MenuElementConfig =
| MenuConfig
| MenuActionConfig
| DeferredMenuElementConfig;
export type MenuConfig = {
// TODO: Next Major Version - Make this required
type?: 'menu';
menuTitle: string;
menuSubtitle?: string;
menuOptions?: Array<UIMenuOptions>;
menuItems?: Array<MenuElementConfig>;
menuPreferredElementSize?: MenuElementSize;
/**
* `IconConfig` is deprecated, use `ImageItemConfig` instead.
* Used to configure what icon or image to show in the submenu.
*
* Note: The icon is only shown if the menu is a submenu. If the menu
* is the root menu, the icon will not be visible.
*/
icon?: IconConfig | ImageItemConfig;
};