diff --git a/README.md b/README.md index d382a18d..9b266f71 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/index.js b/index.js index d65bf4c0..423fb4dc 100644 --- a/index.js +++ b/index.js @@ -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, @@ -38,6 +39,7 @@ const propTypes = { const defaultProps = { data: [], + open: false, onChange: ()=> {}, initValue: 'Select me!', style: {}, @@ -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) {