Get default value for closeWidgets from props #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First off, thank you so much for an amazing suite of date and time picker components you have built.
This PR provides a fix for a super minor bug I found while using
react-datetimerange-picker
in a project.In
DateTimeRangePicker.onDateChange()
the default value for thecloseWidgets
parameter is hardcoded totrue
:this negates the value of the
closeWidgets
prop passed to the component, since that prop value is never passed toonDateChange()
(on line 367, the only place the method is called):So passing
closeWidgets={false}
to the component still results in the widget closing whenever the date changes.This PR simply changes that hardcoded value for
closeWidgets
to use the value already in the class props:alternate approaches
if you don't like the above solution then here are some other ways to fix this issue that I would be happy to implement
closeWidgets
from props:this may be acceptable because the only place this method is called within the library is from the calendar, which can't possibly pass that prop as is, since it has no access to the datetime range picker's internal props. This unfortunately would not be backwards compatible with any third party code that is utilizing
DateTimeRangePicker.onDateChange()
in an external app.onDateChange()
prior to passing off to the calendar that receives the new date values and then supplies the value forcloseWidgets
from props:So again, would be more than happy to implement one of these other approaches if you prefer one of them over the fix in this PR.
Looking forward to hearing back from you.
Thank you for your time, effort, and talent.