diff --git a/index.js b/index.js index 2ca7fb4ba2..a0aa358987 100644 --- a/index.js +++ b/index.js @@ -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); @@ -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); @@ -336,7 +345,7 @@ class DatePicker extends Component { style={Style.datePickerMask} activeOpacity={1} underlayColor={'#00000077'} - onPress={this.onPressCancel} + onPress={this.onPressMask} >