File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -47,10 +47,20 @@ export default class CustomDatePickerIOS extends Component {
4747 }
4848 }
4949
50- _handleConfirm = ( ) => this . props . onConfirm ( this . state . date ) ;
50+ _handleCancel = ( ) => {
51+ this . confirmed = false ;
52+ this . props . onCancel ( ) ;
53+ } ;
54+
55+ _handleConfirm = ( ) => {
56+ this . confirmed = true ;
57+ this . props . onConfirm ( this . state . date ) ;
58+ }
5159
5260 _handleOnModalHide = ( ) => {
53- this . props . onHideAfterConfirm ( this . state . date ) ;
61+ if ( this . confirmed ) {
62+ this . props . onHideAfterConfirm ( this . state . date ) ;
63+ }
5464 } ;
5565
5666 _handleDateChange = date => {
@@ -69,7 +79,6 @@ export default class CustomDatePickerIOS extends Component {
6979
7080 render ( ) {
7181 const {
72- onCancel,
7382 isVisible,
7483 mode,
7584 titleIOS,
@@ -137,7 +146,7 @@ export default class CustomDatePickerIOS extends Component {
137146 </ View >
138147
139148 < View style = { styles . cancelButton } >
140- < TouchableOpacity onPress = { onCancel } >
149+ < TouchableOpacity onPress = { this . _handleCancel } >
141150 { customCancelButtonIOS || cancelButton }
142151 </ TouchableOpacity >
143152 </ View >
You can’t perform that action at this time.
0 commit comments