An open API service indexing awesome lists of open source software.

https://github.com/binbytes/react-native-simple-modal-picker

React Native modal picker for both Android and iOS
https://github.com/binbytes/react-native-simple-modal-picker

chooser drop-down modal modal-dropdown modal-picker modal-selector node-module node-package picker react-native selector

Last synced: 9 months ago
JSON representation

React Native modal picker for both Android and iOS

Awesome Lists containing this project

README

          

# react-native-simple-modal-picker

Easy to use and fully customized modal picker for both iOS and Android. Have same look and feel in both plateform.

## Installation

`$ npm install react-native-simple-modal-picker --save`

### Properties

| Prop | DataType | Description | IsRequired |
|---|---|---|---|
|**`data`**|Array| Data in json format | true |
|**`value`**|String|Name of field which you want tobe return on selection from array | true |
|**`label`**|String|Name of field which you want tobe shown in list of selection | true |
|**`onValueChange`**|function(value)|Will be called on item selection and get value as a argument| true |
|**`renderRow`**|function(rowData)|Custom component for render row and get row data as a argument| false |

## Usage

Here full [example](https://github.com/binbytes/react-native-simple-modal-picker/tree/master/example) of package usage

#### Simple Modal Picker

```js

this.simplePicker = instance}
data={this.data}
label={'name'}
value={'value'}
onValueChange={(value) => alert(value + ' selected')} />

```

![Simple](https://i.imgur.com/xcriwIC.gif)

#### Modal Picker with Custom Row

```js

this.customRowPicker = instance}
data={this.data}
label={'name'}
value={'value'}
onValueChange={(value) => alert(value + ' selected')}
renderRow={(rowData) => {rowData.name}} />

```

![Custom](https://i.imgur.com/NSZ0NfW.gif)

#### DropDown View

```js

this.dropDownPicker = instance}
data={this.data}
label={'name'}
value={'value'}
onValueChange={(value, selectedIndex) => this.setState({selectedIndex})} />

this.dropDownPicker.setModalVisible(true)}>
{this.data[this.state.selectedIndex].name}

```

![DropDown](https://i.imgur.com/rPTVTh6.gif)