2.0.0 • Published 3 years ago

react-native-material-menu v2.0.0

Weekly downloads
7,112
License
MIT
Repository
github
Last release
3 years ago

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

2.0.0

3 years ago

2.0.0-beta.2

3 years ago

2.0.0-beta.1

3 years ago

1.2.0

3 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

5 years ago

0.6.7

5 years ago

0.6.6

5 years ago

0.6.5

5 years ago

0.6.4

5 years ago

0.6.3

5 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.2

5 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.1

7 years ago