@@ -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
@@ -308,7 +317,7 @@ class DatePicker extends Component {
308317 style = { Style . datePickerMask }
309318 activeOpacity = { 1 }
310319 underlayColor = { '#00000077' }
311- onPress = { this . onPressCancel }
320+ onPress = { this . onPressMask }
312321 >
313322 < TouchableHighlight
314323 underlayColor = { '#fff' }
@@ -395,6 +404,7 @@ DatePicker.propTypes = {
395404 onDateChange : React . PropTypes . func ,
396405 onOpenModal : React . PropTypes . func ,
397406 onCloseModal : React . PropTypes . func ,
407+ onPressMask : React . PropTypes . func ,
398408 placeholder : React . PropTypes . string ,
399409 modalOnResponderTerminationRequest : React . PropTypes . func ,
400410 is24Hour : React . PropTypes . bool
0 commit comments