diff --git a/.gitignore b/.gitignore index 4c65070..a880174 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules/ .DS_Store .npm-debug.log .project +yarn* \ No newline at end of file diff --git a/src/index.js b/src/index.js index 7b45c7f..78aeaa5 100644 --- a/src/index.js +++ b/src/index.js @@ -72,6 +72,7 @@ export class DateRangePicker extends Component { this.$picker.data('daterangepicker').setEndDate(currentOptions[key]); } else { this.$picker.data('daterangepicker')[key] = currentOptions[key]; + this.$picker.daterangepicker(this.$picker.data('daterangepicker')); } }); } diff --git a/stories/index.js b/stories/index.js index 9fc81ee..85c5e31 100644 --- a/stories/index.js +++ b/stories/index.js @@ -77,4 +77,48 @@ storiesOf('DateRangePicker', module) ); + }) + .add('PropsUpdate', () => { + class StoryComp extends React.Component { + constructor( props ){ + super(props); + this.state = { + ranges: { + 'ics': [moment('2020-01-02T10:14:33Z'), moment('2020-30-02T10:14:33Z')] + }, + } + + this.onValueChange = this.onValueChange.bind(this); + } + onValueChange () { + setTimeout( () => { + this.setState({ + ranges: { + 'Electronics': [moment('2020-01-02T10:14:33Z'), moment('2020-30-02T10:14:33Z')] + } + }) + }, 1000); + } + render () { + const buttonLabel = text('label', 'click to open'); + return ( +