From 5527144db53d60236fd838ece5f9cec8b3cd86c9 Mon Sep 17 00:00:00 2001 From: Jesse Sessler Date: Tue, 2 May 2017 11:31:55 -0400 Subject: [PATCH] Add onPressMask prop for ios --- index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 74341a6a11..08e2194216 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); @@ -308,7 +317,7 @@ class DatePicker extends Component { style={Style.datePickerMask} activeOpacity={1} underlayColor={'#00000077'} - onPress={this.onPressCancel} + onPress={this.onPressMask} >