You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(iOS): add customIcon and customIconName properties to the action object (#111)
* Add customIcon and customIconColor properties to ContextMenuAction
* Convert the new ContextMenuAction properties
* Set customIcon with customIconColor, if available, for the ContextMenu actions
* Add type declarations for new props
* Update README with new action props, fix other typos
* Add example for new action props
* Update readme and specify the higher priority of customIcon
* Refactor icon and iconColor props on iOS native side
* Remove "system" prefix from icon and iconColor on Android native side
* Update type declarations with new the new prop changes
* Update and format README
* Call processColor for iOS in index.js
System icon refers to an icon name within [SF Symbols](https://developer.apple.com/design/human-interface-guidelines/sf-symbols/overview/) on IOS and Drawable name on Android.
55
+
-`subtitle` is the subtitle of the action (iOS 15+ only)
56
56
57
-
System icon color is only available on Android.
57
+
-`systemIcon` refers to an icon name within [SF Symbols](https://developer.apple.com/design/human-interface-guidelines/sf-symbols/overview/) (iOS only)
58
58
59
-
Destructive items are rendered in red.
59
+
-`icon` refers to an SVG asset name that is provided in Assets.xcassets or to a Drawable on Android; when both `systemIcon` and `icon` are provided, `icon` will take a higher priority and it will override `systemIcon`
60
60
61
-
Selected items have a checkmark next to them on iOS, and unchanged on Android.
61
+
-`iconColor` will change the color of the icon provided to the `icon` prop and has no effect on `systemIcon` (default: black)
62
62
63
-
Menus can be nested one level deep. On iOS submenus can be rendered inline optionally.
63
+
-`destructive` items are rendered in red (iOS only, default: false)
64
64
65
-
###### `onPress`
65
+
-`selected` items have a checkmark next to them (iOS only, default: false)
66
+
67
+
-`disabled` marks whether the action is disabled or not (default: false)
68
+
69
+
-`actions` will provide a one level deep nested menu; when child actions are supplied, the child's callback will contain its name but the same index as the topmost parent menu/action index
70
+
71
+
-`inlineChildren` marks whether its children (if any) should be rendered inline instead of in their own child menu (iOS only, default: false)
72
+
73
+
### `onPress`
66
74
67
75
Optional. When the popup is opened and the user picks an option. Called with `{ nativeEvent: { index, indexPath, name } }`. When a nested action is selected the top level parent index is used for the callback.
68
76
69
-
To get the full path to the item, `indexPath` is an array of indices to reach the item. For a top-levle item, it'll be an array with a single index. For an item one deep, it'll be an array with two indicies.
77
+
To get the full path to the item, `indexPath` is an array of indices to reach the item. For a top-level item, it'll be an array with a single index. For an item one deep, it'll be an array with two indexes.
70
78
71
-
######`onPreviewPress`
79
+
### `onPreviewPress`
72
80
73
81
Optional, iOS only. When the context menu preview is tapped.
74
82
75
-
######`onCancel`
83
+
### `onCancel`
76
84
77
-
Optional. When the popop is opened and the user cancels.
85
+
Optional. When the popup is opened and the user cancels.
78
86
79
-
######`previewBackgroundColor`
87
+
### `previewBackgroundColor`
80
88
81
89
Optional. The background color of the preview. This is displayed underneath your view. Set this to transparent (or another color) if the default causes issues.
82
90
83
-
######`dropdownMenuMode`
91
+
### `dropdownMenuMode`
84
92
85
93
Optional. When set to `true`, the context menu is triggered with a single tap instead of a long press, and a preview is not show and no blur occurs. Uses the iOS 14 Menu API on iOS and a simple tap listener on android.
* The icon to use. This is the name of the SFSymbols icon to use on IOS and name of the Drawable to use on Android.
19
+
* The system icon to use. This is the name of the SFSymbols icon (iOS only).
15
20
*/
16
21
systemIcon?: string;
17
22
/**
18
-
* Color of icon. (Android only)
23
+
* The icon to use. This is the name of the SVG that is provided in Assets.xcassets (iOS) or the name of the Drawable (Android). It overrides the systemIcon prop.
19
24
*/
20
-
systemIconColor?: string;
25
+
icon?: string;
26
+
/**
27
+
* Color of the icon (default: black). The color only applies to the icon provided to the icon prop, as the color of the systemIcon is always black and cannot be changed with this prop.
28
+
*/
29
+
iconColor?: string;
21
30
/**
22
31
* Destructive items are rendered in red on iOS, and unchanged on Android. (default: false)
* Child actions. When child actions are supplied, the childs callback will contain its name but the same index as the topmost parent menu/action index
47
+
* Child actions. When child actions are supplied, the child's callback will contain its name but the same index as the topmost parent menu/action index
0 commit comments