1.0.0-alpha.0 • Published 4 years ago

@sk39/react-native-action-menu v1.0.0-alpha.0

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

react-native-action-menu

Action menu for React Native.

NPM

Dependencies

Install

npm install @sk39/react-native-action-menu

Usage

Props

PropsDefaultDescription
duration400
centralCircleSize130
circleSpaceSize56
import React, {Component} from 'react';
import {TouchableOpacity, View} from 'react-native';
import {ActionMenu} from "react-native-action-menu";

class Example extends Component {
  menuRef = React.createRef<ActionMenu>();

  onSelect(ev, item) {
    const actions = [
        {
            title: "Show Detail",
            method: ()=>console.log("Show Detail"),
            icon: {name: "eye", type: "feather"},
            color: Colors.primary
        },
        {
            title: "Invest",
            method: ()=>console.log("Show Detail"),
            icon: {name: "shopping-cart", type: "feather"},
            color: Colors.second
        }
    ];

    this.menuRef.current.show({
        title: item.name,
        actions,
        py: ev.nativeEvent.pageY
    })
  }

  render () {
    return (
       <View>
          <TouchableOpacity onPress={ev => this.onSelect(ev, item)}>...</TouchableOpacity>
          <ActionMenu ref={this.menuRef}/>
       </View>
    )
  }
}

License

MIT © sk39