From dc0cf7889d26026281307befb7d67762320ece8a Mon Sep 17 00:00:00 2001 From: Dominic Go <18517029+dominicstop@users.noreply.github.com> Date: Thu, 13 Jan 2022 06:37:47 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20README=20WIP:=20Documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 69 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index a67c61c..dcf7097 100644 --- a/README.md +++ b/README.md @@ -281,7 +281,6 @@ const styles = StyleSheet.create({ | 🔤 `onMenuDidHide`

⚛️ [`OnMenuDidHideEvent`](./src/types/MenuEvents.ts) | Event that gets called **after** the context menu is hidden, i.e this event is invoked after the menu exit animation is finished. | | 🔤 `onMenuWillCancel`

⚛️ [`OnMenuWillCancelEvent`](./src/types/MenuEvents.ts) | Event that gets called when the menu is **cancelled and about to be hidden**, i.e this event is immediately invoked when the context menu interaction is cancelled. | | 🔤 `onMenuDidCancel`

⚛️ [`OnMenuDidCancelEvent`](./src/types/MenuEvents.ts) | Event that gets called when the menu is **cancelled and hidden**, i.e. this event is invoked when the context menu is cancelled, and the menu exit transition is finished. | -| 🔤 `onMenuWillCreate`

⚛️ [`OnMenuWillCreateEvent`](./src/types/MenuEvents.ts) | TBA | | 🔤 `onPressMenuItem`

⚛️ [`OnPressMenuItemEvent`](./src/types/MenuEvents.ts) | Event that gets called when a menu action is pressed. You can identify which action was pressed via `nativeEvent.actionKey ` property in the `nativeEvent` object.

Check out [Example 1](#contextmenuview-example-01), and [Example 9](#contextmenuview-example-09) for examples regarding the `onPressMenuItem` event prop. | | 🔤 `onPressMenuPreview`

⚛️ [`OnPressMenuPreviewEvent`](./src/types/MenuEvents.ts) | Event that gets called when the menu's preview is pressed. | @@ -361,12 +360,16 @@ TBA #### `useMenuContext` Hook +A hook to use the `ContextMenuViewContext` context. + TBA
#### `useMenuButtonContext` Hook +A hook to use the `ContextMenuButtonContext` context. + TBA
@@ -379,6 +382,12 @@ TBA ##### Object Type: `MenuConfig` +> A container for grouping related menu elements in an app menu or contextual menu. + +An object that is used to create and configure a context menu. Internally, this object is used to create a `UIMenu` instance (see [apple docs](https://developer.apple.com/documentation/uikit/uimenu/) for more information). + +
+ | Name and Type | Description | | :----------------------------------------------------------- | :---------- | | 🔤 `type`

⚛️ `string`, i.e`"menu"` | TBA | @@ -391,6 +400,10 @@ TBA ##### Object Type: `MenuActionConfig` +An object that is used to create a menu action item in the context menu. Internally, this object is used to create a `UIAction` instance (see [apple docs](https://developer.apple.com/documentation/uikit/uiaction) for more information), + +
+ | Name and Type | Description | | :----------------------------------------------------------- | :---------- | | 🔤 `type`

⚛️ `string`, i.e `"action"` | TBA | @@ -406,33 +419,48 @@ TBA ##### String Union: `MenuAttributes` -| Type | Description | -| :------- | :---------- | -| 🔤 `abc` | TBA | +> Attributes that determine the style of the menu element. + +A union string type that maps to `UIMenuElement.Attributes` enum (see [apple docs](https://developer.apple.com/documentation/uikit/uimenuelement/attributes) for more information). + +
+ +| Type | Description | +| :--------------- | :---------- | +| 🔤 `hidden` | TBA | +| 🔤 `disabled` | TBA | +| 🔤 `destructive` | TBA |
##### String Union: `MenuState` -| Type | Description | -| :--------------------------------------------- | :---------- | -| 🔤 `abc`

⚛️ [`abc`](PLACE_HOLDER_LINK) | TBA | +> Constants that indicate the state of an action- or command-based menu element. + +A union string type that maps to `UIMenuElement.State` enum (see [apple docs](https://developer.apple.com/documentation/uikit/uimenuelement/state) for more information). + +
+ +| Type | Description | +| :--------- | :---------- | +| 🔤 `on` | TBA | +| 🔤 `off` | TBA | +| 🔤 `mixed` | TBA |
##### String Union: `UIMenuOptions` -| Type | Description | -| :--------------------------------------------- | :---------- | -| 🔤 `abc`

⚛️ [`abc`](PLACE_HOLDER_LINK) | TBA | +> Options for configuring a menu's appearance. + +A union string type that maps to `UIMenu.Options` option set (see [apple docs](https://developer.apple.com/documentation/uikit/uimenu/options/) for more information).
-##### String Union: `abc` - -| Type | Description | -| :--------------------------------------------- | :---------- | -| 🔤 `abc`

⚛️ [`abc`](PLACE_HOLDER_LINK) | TBA | +| Type | Description | +| :----------------- | :---------- | +| 🔤 `destructive` | TBA | +| 🔤 `displayInline` | TBA |
@@ -621,8 +649,19 @@ TBA ### D.5. Constants +#### Object: `LIB_ENV` + TBA +
+ +| Type | Description | +| :------------------------------------------------------ | :---------- | +| 🔤 `isContextMenuButtonSupported`

⚛️ `boolean` | TBA | +| 🔤 `isContextMenuViewSupported`

⚛️ `boolean` | TBA | + +
+

## E. Usage And Examples