Skip to content

Commit 09ecdf8

Browse files
authored
Merge pull request xgfe#120 from jemise111/master
feat(datepicker): Add onPressMask prop for ios
2 parents ba55c06 + 5527144 commit 09ecdf8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class DatePicker extends Component {
3636
this.onPressDate = this.onPressDate.bind(this);
3737
this.onPressCancel = this.onPressCancel.bind(this);
3838
this.onPressConfirm = this.onPressConfirm.bind(this);
39+
this.onPressMask = this.onPressMask.bind(this);
3940
this.onDatePicked = this.onDatePicked.bind(this);
4041
this.onTimePicked = this.onTimePicked.bind(this);
4142
this.onDatetimePicked = this.onDatetimePicked.bind(this);
@@ -91,6 +92,14 @@ class DatePicker extends Component {
9192
return true;
9293
}
9394

95+
onPressMask() {
96+
if (typeof this.props.onPressMask === 'function') {
97+
this.props.onPressMask();
98+
} else {
99+
this.onPressCancel();
100+
}
101+
}
102+
94103
onPressCancel() {
95104
this.setModalVisible(false);
96105

@@ -336,7 +345,7 @@ class DatePicker extends Component {
336345
style={Style.datePickerMask}
337346
activeOpacity={1}
338347
underlayColor={'#00000077'}
339-
onPress={this.onPressCancel}
348+
onPress={this.onPressMask}
340349
>
341350
<TouchableHighlight
342351
underlayColor={'#fff'}
@@ -424,6 +433,7 @@ DatePicker.propTypes = {
424433
onDateChange: React.PropTypes.func,
425434
onOpenModal: React.PropTypes.func,
426435
onCloseModal: React.PropTypes.func,
436+
onPressMask: React.PropTypes.func,
427437
placeholder: React.PropTypes.string,
428438
modalOnResponderTerminationRequest: React.PropTypes.func,
429439
is24Hour: React.PropTypes.bool

0 commit comments

Comments
 (0)