Skip to content

Commit

Permalink
Support changing withPortal/withFullScreenPortal
Browse files Browse the repository at this point in the history
I am attempting to set `withFullScreenPortal` in response to the window size (so it only applies on narrow screens). Unfortunately, if `responsivizePickerPosition` is ever called in widescreen (non portal) mode, and the user shrinks the window width....it will now refrain from ever updating/clearing the `dayPickerContainerStyles` (since its a portal!). This bug causes the portal to be displayed with an offset, partially offscreen.
  • Loading branch information
mikelambert committed Aug 12, 2017
1 parent d32e9b3 commit 51e531b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/DateRangePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ export default class DateRangePicker extends React.Component {
}

responsivizePickerPosition() {
// It's possible the portal props have been changed in response to window resizes
// So let's ensure we reset this back to the base state each time
this.setState({ dayPickerContainerStyles: {} });

if (!this.isOpened()) {
return;
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/SingleDatePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ export default class SingleDatePicker extends React.Component {

/* istanbul ignore next */
responsivizePickerPosition() {
// It's possible the portal props have been changed in response to window resizes
// So let's ensure we reset this back to the base state each time
this.setState({ dayPickerContainerStyles: {} });

const {
anchorDirection,
horizontalMargin,
Expand Down

0 comments on commit 51e531b

Please sign in to comment.