Skip to content

Commit 5327272

Browse files
committed
feat(datepicker): Adding support to keepOpenOnClear prop (defaults to false)
1 parent 28288fc commit 5327272

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/datepicker.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class SemanticDatepicker extends React.Component {
2626
clearable: PropTypes.bool,
2727
date: PropTypes.instanceOf(Date),
2828
format: PropTypes.string,
29+
keepOpenOnClear: PropTypes.bool,
2930
locale: PropTypes.object,
3031
onDateChange: PropTypes.func.isRequired,
3132
placeholder: PropTypes.string,
@@ -38,6 +39,7 @@ class SemanticDatepicker extends React.Component {
3839

3940
static defaultProps = {
4041
clearable: true,
42+
keepOpenOnClear: false,
4143
date: undefined,
4244
format: 'YYYY-MM-DD',
4345
locale: localeEn,
@@ -94,9 +96,9 @@ class SemanticDatepicker extends React.Component {
9496
Component = this.isRangeInput ? RangeDatePicker : BasicDatePicker;
9597

9698
resetState = () => {
97-
const { onDateChange } = this.props;
99+
const { keepOpenOnClear, onDateChange } = this.props;
98100
const newState = {
99-
isVisible: false,
101+
isVisible: keepOpenOnClear,
100102
selectedDate: this.isRangeInput ? [] : null,
101103
selectedDateFormatted: '',
102104
};

0 commit comments

Comments
 (0)