Skip to content

Commit

Permalink
Merge pull request #120 from jemise111/master
Browse files Browse the repository at this point in the history
feat(datepicker): Add onPressMask prop for ios
  • Loading branch information
feyy authored May 15, 2017
2 parents ba55c06 + 5527144 commit 09ecdf8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class DatePicker extends Component {
this.onPressDate = this.onPressDate.bind(this);
this.onPressCancel = this.onPressCancel.bind(this);
this.onPressConfirm = this.onPressConfirm.bind(this);
this.onPressMask = this.onPressMask.bind(this);
this.onDatePicked = this.onDatePicked.bind(this);
this.onTimePicked = this.onTimePicked.bind(this);
this.onDatetimePicked = this.onDatetimePicked.bind(this);
Expand Down Expand Up @@ -91,6 +92,14 @@ class DatePicker extends Component {
return true;
}

onPressMask() {
if (typeof this.props.onPressMask === 'function') {
this.props.onPressMask();
} else {
this.onPressCancel();
}
}

onPressCancel() {
this.setModalVisible(false);

Expand Down Expand Up @@ -336,7 +345,7 @@ class DatePicker extends Component {
style={Style.datePickerMask}
activeOpacity={1}
underlayColor={'#00000077'}
onPress={this.onPressCancel}
onPress={this.onPressMask}
>
<TouchableHighlight
underlayColor={'#fff'}
Expand Down Expand Up @@ -424,6 +433,7 @@ DatePicker.propTypes = {
onDateChange: React.PropTypes.func,
onOpenModal: React.PropTypes.func,
onCloseModal: React.PropTypes.func,
onPressMask: React.PropTypes.func,
placeholder: React.PropTypes.string,
modalOnResponderTerminationRequest: React.PropTypes.func,
is24Hour: React.PropTypes.bool
Expand Down

0 comments on commit 09ecdf8

Please sign in to comment.