0.0.9 • Published 8 years ago

react-native-pop-menu v0.0.9

Weekly downloads
8
License
ISC
Repository
github
Last release
8 years ago

npm

react-native-pop-menu

A popup menu component for Android and iOS.

Installation

$ npm install react-native-pop-menu --save

Demo

$cd demo
$npm install
$react-native run-ios

Basic Usage

  render() {
    return (
      <View style={styles.container}>
        <TouchableOpacity style={{ position: 'absolute', right: 12, top: 32 }}
                          onPress={() => {
                            this.setState({
                              menuVisible: true
                            });
                          }}>
          <Text>Menu</Text>
        </TouchableOpacity>
        <Menu visible={this.state.menuVisible}
              onVisible={(isVisible) => {
                this.state.menuVisible = isVisible
              }} 
              data={[
                {
                  title: 'MenuItem 1',
                  onPress: () => {
                    //todo something...
                  }
                },
                {
                  title: 'MenuItem 2',
                  onPress: () => {
                    //todo something...
                  }
                },
              ]} />
      </View>
    );
  }

API

Props:

proptypedescriptiondefault
dataArrayArray that include object which contain 'title' and 'onPress'undefined
topNumberMenu top position74
rightNumberMenu right positionIf not set 'top' and 'right', right = 12
leftNumberMenu left positionIf not set 'top' and 'right', right = 12
visibleBoolDetermines whether your Menu is visibletrue
onVisibleFunctionThe 'onVisible' callback is called when the Menu's visible changedundefined
arrowPositionStringMenu arrow's position, one of 'topRight', 'topLeft', 'topCenter''topRight'
contentStyleView.propTypes.styleEdit the Menu's style{ backgroundColor: defaultColor }
0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago