Skip to content

Commit

Permalink
Added two new properties: onOpenModal and onCloseModal
Browse files Browse the repository at this point in the history
  • Loading branch information
chdwlch committed Jan 28, 2017
1 parent 59d414d commit 846ae35
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,19 @@ class DatePicker extends Component {

onPressCancel() {
this.setModalVisible(false);

if (typeof this.props.onCloseModal === 'function') {
this.props.onCloseModal();
}
}

onPressConfirm() {
this.datePicked();
this.setModalVisible(false);

if (typeof this.props.onCloseModal === 'function') {
this.props.onCloseModal();
}
}

getDate(date = this.props.date) {
Expand Down Expand Up @@ -228,6 +236,10 @@ class DatePicker extends Component {
}).then(this.onDatetimePicked);
}
}

if (typeof this.props.onOpenModal === 'function') {
this.props.onOpenModal();
}
}

render() {
Expand Down Expand Up @@ -361,6 +373,8 @@ DatePicker.propTypes = {
showIcon: React.PropTypes.bool,
disabled: React.PropTypes.bool,
onDateChange: React.PropTypes.func,
onOpenModal: React.PropTypes.func,
onCloseModal: React.PropTypes.func,
placeholder: React.PropTypes.string,
modalOnResponderTerminationRequest: React.PropTypes.func,
is24Hour: React.PropTypes.bool
Expand Down

0 comments on commit 846ae35

Please sign in to comment.