1.0.1 • Published 6 years ago

react-native-amazon-modal-picker v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

react-native-amazon-modal-picker

npm npm licence npm downloads

React Native selection modal inspired by Amazon's mobile application modal.

Install

To get started install via npm:

 npm install react-native-amazon-modal-picker --save

Usage

To use in React Native. Import:

 import ModalSelect from 'react-native-amazon-modal-picker';

Then add it to your code:

<ModalSelect
  isVisible={this.state.modalOpen}
  title='Selector'
  labels={[...Array(30).keys()]}
  onSelect={(value) => {
    this.setState({ modalValue: value, modalOpen: false }); //<- Closes Modal and sets value
  }}
  headerColor='#6e2ccd' />

Props

PropTypeOptionalDefaultDescription
isVisibleboolNofalseIs the modal visible?
onSelectfuncNoFunction which gets called when a option is pressed. Value passed as parameter.
titlestringYes'Select'Tile of modal
labelsarrayNoArray of labels to render in modal
valuesarrayYesCustom values to pass to onSelect when item is clicked. Must be equal length to labels
headerColorstringYes'#CD2C2E'Colour of header

Todo

  • Use ListView to render items in modal instead of ScrollView

Contributing

If you want to issue a PR, go ahead ;)

Authors

License

This project is licensed under the MIT License