Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class SampleApp extends Component {
## Props

* `data - []` required, array of objects with a unique key and label
* `open - boolean` optional, boolean that triggers whether or not the dialog is shown
* `style - object` optional, style definitions for the root element
* `onChange - function` optional, callback function, when the users has selected an option
* `initValue - string` optional, text that is initially shown on the button
Expand Down
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ let componentIndex = 0;

const propTypes = {
data: PropTypes.array,
open: PropTypes.bool,
onChange: PropTypes.func,
initValue: PropTypes.string,
style: View.propTypes.style,
Expand All @@ -38,6 +39,7 @@ const propTypes = {

const defaultProps = {
data: [],
open: false,
onChange: ()=> {},
initValue: 'Select me!',
style: {},
Expand Down Expand Up @@ -82,6 +84,7 @@ export default class ModalPicker extends BaseComponent {
if (nextProps.initValue != this.props.initValue) {
this.setState({selected: nextProps.initValue});
}
this.setState({modalVisible: nextProps.open});
}

onChange(item) {
Expand Down