A react-native component to use context menu's (UIMenu) on iOS 13/14+
A react-native component to use context menu's (UIMenu) on iOS 13/14+
A small component for using context menu's on iOS.
Hiatus Notice: Unfortunately, i'm no longer doing OSS for the time being, so this library is in maintenance mode (if you're interested in sponsoring my work or picking up the project, please don't hesitate to contact me).
Regarding Version 2.x: Hello, please note that versions 2.x and below of this library are no longer supported; please do not submit an issue if the version you are using is below 3.x.
Regarding Documentation: See TODO.md for progress.
PLACE_HOLDER_LINK).| Notice |
|---|
Note #1: Version 3.x is a rewrite of this library to support both fabric (the new architecture), and offer backwards compatibility to paper (the old architecture). |
Support for the new architecture (fabric), and backwards compatibility for the old architecture (paper) is handled via a peer via a peer dependency to react-native-ios-utilites@v5. |
| Note #2: The documentation + examples are currently being rewritten.
❤️ README-old-v1.md — Documentation for v1.x
README-old-v2.md — Documentation for v2.x
example/src/examples — The typescript rewrite of the examples (WIP). |
| Library Version | Compatibility |
|---|---|
3.x+ |
Depends on [email protected] |
Depends on ContextMenuAuxiliaryPreview |
|
| iOS 13+ | |
| Xcode 15+ | |
2.1 |
Uses Expo-Modules |
Depends on [email protected] |
|
Depends on ContextMenuAuxiliaryPreview |
|
| iOS 13+ | |
| Xcode 15+ | |
2.0.x |
Uses Expo-Modules |
Depends on [email protected] |
|
| iOS 13+ | |
| Xcode 15+ | |
1.6.2 |
iOS 10 to iOS 15 |
| Xcode 12+ | |
1.4 |
iOS 10 to iOS 15 |
| Xcode 13+ | |
1.3 and Below |
iOS 10 to 14 |
| Xcode 12+ |
| Sections and Links |
|---|
| A. Introduction |
• Gifs and Demos • Features | | B. Installation
• Expo • Troubleshooting --• Xcode Build Error (Swift) --• Xcode Build Error (Undefined symbol) | | C. Basic Usage | | D. Documentation
• D.1. Components
--• ContextMenuView Component
----• Props
----• Event Props
----• Properties/Methods
----• Experimental - Aux. Preview
--• ContextMenuButton Component
----• Props
----• Event Props
----• Properties/Methods
• D.2. Context
--• ContextMenuButtonContext
--• ContextMenuButtonContext
• D.3. Hooks
--• useMenuContext
--• useMenuButtonContext
• D.4. Objects and Types
--• MenuConfig.ts
----• Object Type: MenuConfig
----• Object Type: MenuActionConfig
----• Object Type: DeferredMenuElementConfig
----• String Union: MenuAttributes
----• String Union: MenuState
----• String Union: UIMenuOptions
--• MenuPreviewConfig.ts
----• Object Type: MenuPreviewConfig
----• String Union: ContextMenuInteractionCommitStyle
----• String Union: MenuPreviewSize
----• String Union: MenuPreviewType
--• MenuAuxiliaryPreviewConfig.ts
----• Object Type: MenuAuxiliaryPreviewConfig
----• String Union Type: MenuAuxiliaryPreviewAnchorPosition
----• String Union Type: MenuAuxiliaryPreviewHorizontalAlignment
----• String Union Type: UIViewAnimateOptions
----• Object Type: UIViewAnimateConfig
----• Object Type: MenuAuxiliaryPreviewBaseTransitionConfig
----• Object Union Type: MenuAuxiliaryPreviewTransitionConfig
----• Mixed Union Type: MenuAuxiliaryPreviewTransitionEntranceDelay
--• MenuIconConfig.ts
--• ImageItemConfig.ts
----• Object Type: ImageItemConfig
----• Object Type: ImageResolvedAssetSource
----• Object Type: ImageRectConfig
----• Object Type: ImageGradientConfig
----• Object Type: ImageSystemConfig
• D.5. Constants | | E. Usage And Examples Note: See Example Index section for a complete list of examples + their descriptions. | | F. Showcase, Tests and Demos | | G. Meta | | H. Licence |
| Examples |
|---|
ContextMenuView Example 01 |
| Summary: A basic context menu that has 3 menu action items. |
ContextMenuView Example 02 |
| Summary: Icon Example — A basic context menu that has 3 menu action items, each with a different "SF Symbols" icon. This examples shows how to add a system icon in the context menu action. |
ContextMenuView Example 03 |
| Summary: Nested Menu — This example shows a context menu that has a submenu item inside its list of menu actions. |
ContextMenuView Example 04 |
Summary: Menu Attributes — This example context menu showcases the MenuActionConfig.menuAttributes property. |
ContextMenuView Example 05 |
| Summary: Nested Menu + Menu Attributes — A context menu that has a in-line submenu. |
ContextMenuView Example 06 |
| Summary: Menu Options — A context menu that has a destructive submenu. |
ContextMenuView Example 07 |
| Summary: Menu Options — A context menu that set to be both "destructive" and "display in-line". |
ContextMenuView Example 08 |
Summary: Menu State — A context menu with 3 actions that has 'on', 'off', and 'mixed' menuState. |
ContextMenuView Example 09 |
Summary: Events — An example for the onPressMenuItem event prop. |
ContextMenuView Example 10 |
| Summary: Dynamic Menu — An example showing how to dynamically update the context menu while it's visible. In this example, the menu action changes every time the counter increments every second. |
ContextMenuView Example 11 |
| Summary: Context Menu Previews — An example showing how to use a custom preview for the context menu. |
ContextMenuView Example 12 |
| Summary: Context Menu Previews — An example showing a custom context menu preview that dynamically changes its size due to its contents updating every second. |
ContextMenuView Example 13 |
| Summary: Menu Action — An example showing how to add a subtitle to menu action. |
ContextMenuView Example 14 |
Summary: Context Menu Previews — An example that changes the exit transition of the context menu preview when its tapped using the preferredCommitStyle config. |
ContextMenuView Example 15 |
| Summary: Context Menu Previews — An example showing how to configure a context menu that uses targeted previews. |
ContextMenuView Example 15-02 |
Summary: Context Menu Previews (Cont). — An example showing how to configure a context menu that uses targeted previews + WrapperView. |
ContextMenuView Example 16 |
Summary: Icon Example — An example showing a context menu with an action that uses a 'IMAGE_ASSET' image for its icon. |
ContextMenuView Example 17 |
| Summary: Icon Example — An example showing a context menu with action items that have different colored icons. |
ContextMenuView Example 18 |
Summary: Icon Example — An example showing a context menu with action items that has icons that uses local image assets imported via require(...). |
ContextMenuView Example 19 |
| Summary: Dynamic Menu — An example showing a context menu that has a loading indicator using deferred menu elements. |
ContextMenuView Example 20 |
| Summary: Dynamic Menu — An example showing a state-controlled context menu that shows a loading indicator using deferred menu elements. |
ContextMenuView Example 21 |
| Summary: Menu Element Size — TBA |
ContextMenuView Example 22 |
| Summary: Menu Element Size — TBA |
ContextMenuView Example 23 |
| Summary: Menu Element Size — TBA |
ContextMenuView Example 24 |
Summary: Menu Attributes — keepsMenuPresented |
ContextMenuView Example 25 |
Summary: Icon Example — Advanced customization (E.g. scale, weight, paletteColors, hierarchicalColor). |
| **[ |
No open issues yet, or sync has not completed.