npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-context-menu-strip

v0.0.2

Published

ContextMenuStrip

Downloads

5

Readme

react-native-context-menu-strip

  npm version  

A ContextMenuStrip component for react-native, Inspired from react-native-action-button

react-native-context-menu-strip example

Installation

npm i react-native-context-menu-strip --save

Usage

import ContextMenuStrip from 'react-native-context-menu-strip'

ContextMenuStrip

ContextMenuStrip component is the main component.

props

| prop | default | type | description | | ---- | ---- | ----| ---- | | autoInactive | true | boolean | Auto hide ContextMenu when ContextMenuStrip.Item is pressed | | width | 60 | number | width of menu button | | height | 48 | number | height of menu button | | circleRadius | 40 | number | radius of circle which wrap '+' icon | | itemWidth | 150 | number | width of item button | | itemHeight | 38 | number | height of item button | | itemType | 'highlight' | 'opacity' or 'highlight' | type of item button | | itemBgColor | 'transparent' | string | backgroundColor of item | | itemUnderlayColor | '#F8F7F7' | string | underlayColor of item | | btnUnderlayColor | '#F8F7F7' | string | underlayColor of menu's main button | | btnColor | 'transparent' | string | backgroundColor of menu's main button, (must be rgba value!) | | btnColorRange | undefined | string | backgroundColor of menu's main button when menu opened, (must be rgba value!) | | degrees | 135 | number | degrees to rotate icon when menu opened | | scaleRange | undefined | number | scale to resize menu's main button | | menuBorderColor | '#D5D5D5' | string | borderColor of menu | | menuMarginRight | 0 | number | marginRight of menu items | | menuMarginTop | 0 | number | marginTop of menu items | | icon | undefined | component | '+' icon | | onPress | () = {} | function | callback when menu's main button is pressed | | onReset | undefined | function | callback when menu reset |

ContextMenuStrip.Item

ContextMenuStrip.Item specifies a menu Button.

props

| prop | default | type | description | | ---- | ---- | ----| ---- | | customized | false | boolean | when customize === false, you need to specify icon and label, when customize === false, you need to specify a child component. | | btnColor | undefined | string | background color of item button | | onPress | undefined | function | callback when item button is pressed | | iconSize | 20 | number | radius of icon on item button | | itemWidth | 150 | number | width of item button | | iconName | undefined | number or string | source of Image component or iconName of react-native-vector-icon's component | | iconType | undefined | PropTypes.oneOf(['Zocial', 'Octicons', 'MaterialIcons', 'Ionicons', 'Foundation', 'EvilIcons', 'Entypo', 'FontAwesome', 'Image']) | type of icon | | label | undefined | string | label on item button |

Example

The following example can be found in example.

import React, { Component } from 'react';
import {
  AppRegistry,
  BackAndroid,
  Platform,
  Text,
  View,
  Image,
} from 'react-native';
import ContextMenuStrip from 'react-native-context-menu-strip'

class example extends Component {
  contextMenuStrip

  constructor (props) {
    super(props)
    this.state = {
      menuActive: false,
    }
  }

  onMenuToggled (expand) {
    this.setState({menuActive: expand})
  }

  componentDidMount () {
    BackAndroid.addEventListener('hardwareBackPress', () => this.handleBackButton())
  }

  componentWillUnmount () {
    BackAndroid.removeEventListener('hardwareBackPress', () => this.handleBackButton())
  }

  handleBackButton () {
    if (this.state.menuActive) {
      this.setState({
        menuActive: false,
      })
      this.contextMenuStrip.reset()
      return true
    }

    // navigator

    // finally
    return false
  }

  render() {
    return (
      <ContextMenuStrip
        ref={(c) => this.contextMenuStrip = c}
        width={60}
        height={Platform.OS === 'ios' ? 40 : 48}
        itemWidth={150}
        itemHeight={38}
        btnSize={40}
        degrees={135}
        scaleRange={1.5}
        btnColorRange="rgba(88,66,77,0.8)"
        menuMarginRight={10}
        onPress={() => this.onMenuToggled(true)}
        onReset={() => this.onMenuToggled(false)}>

        {/*Icon*/}
        <ContextMenuStrip.Item
          iconType="FontAwesome"
          iconName="comments"
          label="chat"
          onPress={() => {}}
        />
        <ContextMenuStrip.Item
          iconType="FontAwesome"
          iconName="gear"
          label="setting"
          onPress={() => {}}
        />
        <ContextMenuStrip.Item
          iconType="FontAwesome"
          iconName="refresh"
          label="refresh"
          onPress={() => {}}
        />

        {/*Image Icon*/}
        <ContextMenuStrip.Item
          iconType="Image"
          iconName={require('./icons/about.png')}
          label="about"
          onPress={() => {}}
        />

        {/*Customize*/}
        <ContextMenuStrip.Item
          customized={true}
          onPress={() => {}}>
          <View style={{
            flex: 1,
            flexDirection: 'row',
            justifyContent: 'flex-start',
            alignItems: 'center',
          }}>
            <View style={{
              width: 45,
              flexDirection: 'row',
              justifyContent: 'center',
              alignItems: 'center',
            }}>
              <Image
                style={{
                  width: 20,
                  height: 20,
                  flexDirection: 'row',
                  justifyContent: 'center',
                  alignItems: 'center',
                  marginLeft: 5,
                }}
                source={require('./icons/chat.png')}
              />
            </View>

            <Text
              style={{
                flexDirection: 'row',
                justifyContent: 'center',
                alignItems: 'center',
                marginLeft: 5,
              }}
            >
              Come on
            </Text>
          </View>
        </ContextMenuStrip.Item>

      </ContextMenuStrip>
    )
  }
}


AppRegistry.registerComponent('example', () => example)