@sk39/react-native-action-menu
v1.0.0-alpha.0
Published
Action menu for React Native
Downloads
11
Readme
react-native-action-menu
Action menu for React Native.
Dependencies
Install
npm install @sk39/react-native-action-menu
Usage
Props
| Props | Default | Description | | ------------- |:-------------:| -----:| | duration | 400 | | | centralCircleSize | 130 | | | circleSpaceSize | 56 | |
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