1.0.7 • Published 3 years ago

native-x-context-menu v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

native-x-context-menu

semantic-release

Component that providers context menu capabilities

Install

Yarn

yarn add native-x-context-menu

NPM

npm install native-x-context-menu

Usage

import {
  ContextMenu,
  ContextMenuItem,
  ContextMenuProvider,
  ContextMenuSeparator,
} from 'native-x-context-menu'
import { CheckmarkIcon, CloseIcon, CopyOutlineIcon, TrashOutlineIcon } from 'native-x-icon'

function MyComponent() {
  return (
    <ContextMenuProvider>
      ...
      <ContextMenu>
        <ContextMenuItem icon={CheckmarkIcon}>Approve</ContextMenuItem>
        <ContextMenuItem icon={CloseIcon} onPress={() => Alert.alert('Reject')}>
          Reject
        </ContextMenuItem>
        <ContextMenuSeparator />
        <ContextMenuItem icon={CopyOutlineIcon} disabled>
          Copy Link
        </ContextMenuItem>
        <ContextMenuSeparator />
        <ContextMenuItem textColor={COLOR.ERROR} icon={TrashOutlineIcon}>
          Delete
        </ContextMenuItem>
      </ContextMenu>
    </ContextMenuProvider>
  )
}

API ContextMenu

PropertyDefault ValueUsage
backgroundColor?: stringCOLOR.PRIMARYContainer color
textColor?: stringCOLOR.SECONDARYDefault color for ContextMenuItem
iconColor?: stringCOLOR.TERTIARYDefault icon color for ContextMenuItem
children?: ReactElement[]List of ContextMenuItem

API ContextMenuItem

PropertyDefault ValueUsage
children: stringMenu text
icon?: ReactElementIcon. Eg: icon={}
disabled?: booleanDisabled if true
backgroundColor?: stringCOLOR.PRIMARYBackground color
textColor?: stringCOLOR.SECONDARYText color for ContextMenuItem - overrides textColor from ContextMenu
iconColor?: stringCOLOR.TERTIARYText color for ContextMenuItem - overrides iconColor from ContextMenu
onPress?: () => voidCallback handler for onPress

Automatic Release

Here is an example of the release type that will be done based on a commit messages:

Commit messageRelease type
fix: commentPatch Release
feat: commentMinor Feature Release
perf: commentMajor Feature Release
doc: commentNo Release
refactor: commentNo Release
chore: commentNo Release