From f194e0d38e751ee40707f0c75920df1a552d54ab Mon Sep 17 00:00:00 2001 From: ali Date: Wed, 9 Aug 2017 17:54:37 +0430 Subject: [PATCH] add "closeOnSelect" attribute to DatePicker --- examples/src/components/App.js | 11 +++++++++++ src/components/DatePicker.js | 7 +++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/src/components/App.js b/examples/src/components/App.js index 4f70bb5..ca0e12a 100644 --- a/examples/src/components/App.js +++ b/examples/src/components/App.js @@ -48,6 +48,13 @@ export default class App extends Component { +
+ + + +
; }`; +const basicAutoDatePickerCode = `render() { + return ; +}`; + const clearDatePickerCode = `render() { return ( diff --git a/src/components/DatePicker.js b/src/components/DatePicker.js index 2520c63..f7ea40f 100644 --- a/src/components/DatePicker.js +++ b/src/components/DatePicker.js @@ -21,13 +21,15 @@ export default class DatePicker extends Component { removable: PropTypes.bool, timePickerComponent: PropTypes.func, calendarStyles: PropTypes.object, - calendarContainerProps: PropTypes.object + calendarContainerProps: PropTypes.object, + closeOnSelect: PropTypes.bool }; static defaultProps = { inputFormat: 'jYYYY/jM/jD', calendarStyles: require('../styles/basic.css'), - calendarContainerProps: {} + calendarContainerProps: {}, + closeOnSelect: false }; state = { @@ -98,6 +100,7 @@ export default class DatePicker extends Component { } this.setMomentValue(momentValue); + this.setState({isOpen: !this.props.closeOnSelect}) } handleInputChange(event) {