question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

As of 4.1.0 - <SingleDatePicker> only displays when the window is resized. The 'left' property is incorrectly set.

See original GitHub issue

First, just want to say thank you to all the contributors of this great library. It’s been a pleasure to work with. The examples are great too.


Issue Summary

I’ve got a <SingleDatePicker> like this:

<SingleDatePicker
  id="changeUntil"
  focused
  placeHolder="MM/DD/YYYY"
  date={this.state.until}
  numberOfMonths={2}
  isDayBlocked={d => d.isAfter(moment().add(5, 'year'))}
  onDateChange={s => this.setState({
    // end things at last moment of
    // the end date chosen
    until: s.endOf('day'),
    count: null,
    untilModal: false,
    currentlyChoosing: null,
  })}
  orientation="vertical"
/>

It is mounted in a modal which opens - and when the modal closes it unmounts its children. The issue is that under this configuration the <SingleDatePicker> has the wrong left style attribute until the window is resized. This happens for orientation vertical or horizontal.


Issue Proof (video)

screencast 2016-12-02 12-11-34


My Current Solution

In my app stylesheet I simply added:


.SingleDatePicker__picker--direction-left {
  left: 0!important;
}

Which fixes it. Fortunately !important overrides the inline style applied by the library.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

1reaction
niffletscommented, Feb 2, 2017

I would like to add that I’m seeing a similar issue but for the DateRangePicker. It is in a modal that transitions its positioning and mounts while in the “before transition” position. As a result, the DateRangePicker position is incorrect as responsivizePickerPosition() doesn’t get called again until the window is resized. I’m also using the left: 0px !important workaround.

0reactions
lasergoatcommented, Mar 2, 2017

@majapw Sorry for the delay, my fix above works so well I totally forgot about this issue. Here’s a video showing the same behavior in horizontal mode without my css fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

<SingleDatePicker> only displays when the window is resized ...
As of 4.1.0 - <SingleDatePicker> only displays when the window is resized. The 'left' property is incorrectly set. #207.
Read more >
Change how a date or time is displayed in a date picker, text ...
Double-click the date picker, text box, or expression box control whose data you want to format. In the Control Properties dialog box, do...
Read more >
Releases | Adjust Atlas
Prevent HeaderMenu opening when resizing column in Table component. (Ticket ATLAS-444). ... Fixed tooltip position when window size is small in ComboBox.
Read more >
Ext.picker.Date | Ext JS 6.2.0 - Sencha Documentation
Summary. A date picker. This class is used by the Ext.form.field.Date field to allow browsing and selection of valid dates in a popup...
Read more >
react-dates | Yarn - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn. ≡. Home · Getting started.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found