Socket
Socket
Sign inDemoInstall

react-native-material-menu

Package Overview
Dependencies
514
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-material-menu

Material Menu for React Native


Version published
Weekly downloads
8.9K
increased by9.26%
Maintainers
1
Install size
26.3 kB
Created
Weekly downloads
 

Readme

Source

react-native-material-menu · npm license

Pure JavaScript material menu component for React Native with automatic RTL support.

Install

Using yarn

yarn add react-native-material-menu

or using npm

npm install --save react-native-material-menu

Usage example (expo demo)

import React from 'react';
import React, { useState } from 'react';

import { View, Text } from 'react-native';
import { Menu, MenuItem, MenuDivider } from 'react-native-material-menu';

export default function App() {
  const [visible, setVisible] = useState(false);

  const hideMenu = () => setVisible(false);

  const showMenu = () => setVisible(true);

  return (
    <View style={{ height: '100%', alignItems: 'center', justifyContent: 'center' }}>
      <Menu
        visible={visible}
        anchor={<Text onPress={showMenu}>Show menu</Text>}
        onRequestClose={hideMenu}
      >
        <MenuItem onPress={hideMenu}>Menu item 1</MenuItem>
        <MenuItem onPress={hideMenu}>Menu item 2</MenuItem>
        <MenuItem disabled>Disabled item</MenuItem>
        <MenuDivider />
        <MenuItem onPress={hideMenu}>Menu item 4</MenuItem>
      </Menu>
    </View>
  );
}

Menu

namedescriptiontypedefault
childrenComponents rendered in menu (required)ReactNode-
anchorButton component (required)ReactNode-
visibleWhether the Menu is currently visibleBoolean-
styleMenu styleStyle-
onRequestCloseCallback when menu has become hiddenFunction-
animationDurationChanges show() and hide() durationNumber300

MenuItem

namedescriptiontypedefault
childrenRendered children (required)ReactNode-
disabledDisabled flagBooleanfalse
disabledTextColorDisabled text colorString'#bdbdbd'
onPressCalled function on pressFunc-
styleContainer styleStyle-
textStyleText styleStyle-
pressColorPressed colorString'#e0e0e0'

Children must be based on <Text> component (like text itself, strings, react-native-vector-icons or expo icons) otherwise you may get an error on a real device.

MenuDivider

namedescriptiontypedefault
colorLine colorString'rgba(0,0,0,0.12)'

Pietile native kit

Also take a look at other our components for react-native - pietile-native-kit

License

MIT License. © Maksim Milyutin 2017-2021

Keywords

FAQs

Last updated on 23 Aug 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc