react-native-side-reveal-menu
Animated menu component for React Native. Inspired by this native android component: https://android-arsenal.com/details/1/1388
Installation
npm install --save react-native-side-reveal-menu
Example usage
This example uses react-native-vector-icons package but feel free to put anything else into the MenuItem components.
;;;; { superprops; thisstate = menuOpened: true thisonBtnPress = thisonBtnPress; } { this; } { return <View style=stylescontainer> <TouchableNativeFeedback onPress=thisonBtnPress> <View style=stylesbtn><Text style=stylestext>Toggle Menu</Text></View> </TouchableNativeFeedback> <Menu isOpened=thisstatemenuOpened> <MenuItem onPress= console> <Icon name="address-book" size=25 color="#fff" /> </MenuItem> <MenuItem onPress= console> <Icon name="calendar" size=25 color="#fff" /> </MenuItem> <MenuItem onPress= console> <Icon name="envelope" size=25 color="#fff" /> </MenuItem> <MenuItem onPress= console> <Icon name="info" size=25 color="#fff" /> </MenuItem> <MenuItem onPress= console> <Icon name="user" size=25 color="#fff" /> </MenuItem> </Menu> </View > ; } const styles = StyleSheet; AppRegistry;
Properties
Prop | Description | Default |
---|---|---|
onShow |
Method that runs when menu is showing. | empty |
onHide |
Method that runs when menu is hiding. | empty |
borderRadius |
Border radius of menu items. Keep in mind that if items are rendered together, only first and last items will have rounded corners. | 0 |
showActiveItem |
Highlights pressed menu item with the activeItemColor color if set to true. |
true |
showItemsSeparator |
Renders a separator between each item. | true |
inactiveItemColor |
Default background color of every item. Must be a valid hex value (won't work with named colors like 'red'). | #33334C |
activeItemColor |
Default background color of selected item. Must be a valid hex value (won't work with named colors like 'red'). | #D64A73 |
itemsDistribution |
Defines how menu items are distributed. Similar to flex justifyContent . |
'top', 'center', 'bottom', 'space-between', 'space-around' |
itemAnimDuration |
Duration of animation of single menu item in miliseconds. | 150 |
itemAnimDelay |
Delay of susequent menu item animations. | 50 |
itemAnimEasing |
Allow to specify custom easing function. Must be a valid react native easing function. | Easing.inOut(Easing.ease) |