Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusts DayPicker height and initializes width when DayPicker is about to be shown #196

Merged
merged 1 commit into from
Nov 30, 2016

Conversation

majapw
Copy link
Collaborator

@majapw majapw commented Nov 22, 2016

This should hopefully fix #177 and also #105 and #46. Lol. Lots of dupes.

The idea is that while we use visibility: hidden in place of display: none when hiding the DayPicker so we can measure it properly, we can't actually guarantee that some parent isn't hiding the whole thing using display: none (in some modal implementations, for instance). This alleviates the issue somewhat by doing these DOM calculations right before we show the DayPicker (which can only happen when you click on or focus on a visible DateRangePicker component).

@subicura does this fix your issue?

Please take a look @airbnb/webinfra!

@majapw majapw added the semver-patch: fixes/refactors/etc Anything that's not major or minor. label Nov 22, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 86.657% when pulling 04a6956 on maja-fix-uninitialized-width-issue into 2d86825 on master.

this.setState({
currentMonth: nextProps.initialVisibleMonth(),
});
if (!nextProps.hidden) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if perhaps componentDidUpdate would be a better place to do this computation, since that should fire every time the component rerenders?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thought, especially for the height which affects the visual appearance of the calendar on opening, is that we want to do this ASAP. While there is still somewhat of a delay in growing of the height of the DayPicker, I believe it is less noticeable here than in componentDidUpdate. I'll look side-by-side but it would make sense for that to be the case.

Other than the initial load, this only needs to fire when you navigate months and I believe that is already happening in componentDidUpdate.

@majapw majapw force-pushed the maja-fix-uninitialized-width-issue branch from 04a6956 to 4c66b0d Compare November 30, 2016 18:22
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 86.657% when pulling 4c66b0d on maja-fix-uninitialized-width-issue into b904455 on master.

@majapw majapw merged commit 32bb58d into master Nov 30, 2016
@majapw majapw deleted the maja-fix-uninitialized-width-issue branch November 30, 2016 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch: fixes/refactors/etc Anything that's not major or minor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Width calculate bug in modal view
3 participants