react-native-option-picker
v1.1.2
Published
A simple and customizable React Native option picker tool.
Downloads
28
Maintainers
Readme
react-native-option-picker
A simple and customizable React Native option picker tool.
Getting Started
View example on snack.expo.io
Install
$ npm install react-native-option-picker
Basic Usage
import {Picker} from 'react-native-option-picker';
export const CustomPicker = () => {
function _onPress(elem){
alert(JSON.stringify(elem));
}
return (
<Picker
data={[
{ id: '9', title: '9:00 AM', selected: false },
{ id: '10', title: '10:00 AM', selected: true },
{ id: '11', title: '11:00 AM', selected: false },
]}
onPress={this._onPress}
/>
);
};
Styling
| Prop | Description | Type |
| ------------- |:-------------:| -----:|
| style
| Picker styling | Any |
| optionStyle
| Style for the idle option | Any |
| selectedOptionStyle
| Style for the selected option | Any |
| optionTextStyle
| Style for the option text | Any |
| selectedOptionTextStyle
| Style for the selected option text | Any |
Methods
Methods may be accessed through the instantiated component's ref.
| Prop | Description |
| ------------------------------------- | --------------------------------------------------------------------------------- |
| onPress(element)
| Returns the selected element when an option is selected. |
Contributing
Contributions are welcome!
- Fork it.
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Or open up an issue.
Contributors
Discussion and Collaboration
In addition to the Github Issues page
License
Licensed under the MIT License.