Comments (13)
I'm not sure what you might be doing to get a zero width gutter...The logic is that it checks the max width of the gutters after it's laid out and then uses that width to sync the various gutter cells so they don't end up with different widths.
Is your Calendar starting hidden or something?
from react-big-calendar.
We are creating a calendar that has a main content window with three distinct sections. There are 2 containers side-by-side. The left container has a calendar that takes up the top 60% of the container, with the bottom 40% being devoted to the "day/time" view. The "day" view part in the bottom container always ends up with a 0 width until a new date is clicked. Once a new date is clicked, the gutters appear, but only with 10px total width, and I think that is due to the padding: 0 5px;
from react-big-calendar.
There is nothing hidden on the page, and the calendars default to the current date.
from react-big-calendar.
When the page is first loaded, the left gutter shows, but only due to the padding: 0 5px
. The actual width that gets set on the element is 0px:
Once you click a new date, the gutter on the right appears, but it also has a 0 width, getting its width from the padding
style as well:
In addition, the gutter never shows below the "all day" row.
from react-big-calendar.
I added a check that should prevent 0 width gutters, I am hoping that it resolves your issue let me know.
from react-big-calendar.
Will do. Is this available now? If so, I will update immediately. Thank you very much for the prompt responses.
from react-big-calendar.
I have been toying with things for a little bit now, and the gutter is better, but it still doesn't seem to be completely working.
When I first open the calendar, the gutter is there, but it is uneven:
After selecting a new date the first time, the gutter adjusts to the perfect size:
However, if you select another date after that, the sizing gets jumbled again, and then stays that way:
from react-big-calendar.
What if you could pass gutterWidth as a prop? Would this be possible? At least then, I could override it if necessary or something.
from react-big-calendar.
I think it may have something to do with being initiated originally on an unselected (and therefore hidden) tab. Is there a way to account for sizing when initialized that way? For what it's worth, _adjustGutter
runs again when the tab is selected and the calendar views shown.
from react-big-calendar.
so the view is hidden to begin with? The issue is you can't measure anything if its not visible, which is why this is happening, and to be honest there isn't a ton I can do to make it better I think, aside from just picking a default gutter width, since I can't detect when things become visible to correctly update the value.
perhaps some sort of prop is the best bet, but I find that API annoyingly ugly hmm.
from react-big-calendar.
It does get re-rendered again before becoming visible though, so shouldn't it be able to figure out any needed values for calculation consistently?
The view begins on the second of two tabs. Upon selecting the tab, the tab with the Calendars becomes active, and it triggers another run thru _adjustGutter
.
from react-big-calendar.
Yeah it should if its rerendering, would you mind stepping through _adjustGutter to see why its not getting a width correctly in that instance?
from react-big-calendar.
No problem.
Initial Render
width
is undefined, due to this._gutterWidth
being undefined to that point.
gutterCells
contains 3 elements, .rbc-time-gutter
& 2 .rbc-gutter-cell
.
The if (width)
check then prevents the size from being set.
this._gutterWidth
gets set to 0, as all of the items come back as 0 width.
When if (this._gutterWidth && width !== this._gutterWidth)
runs, this._gutterWidth = 0, width = undefined
and the resize is again prevented.
Second (and third) Try (Tab is selected)
This time, both width
and this._gutterWidth
come out to zero, thus skipping both of the resizes once more.
Interesting note, when I hit my breakpoint, nothing from the calendar appears to have actually rendered yet. Unsure if this is due to Chrome not displaying DOM changes at a breakpoint, but you would think that it would already be showing if it had rendered already.
This, for some reason, gets run twice upon switching to the tab (I assume this is some issue with my implementation). Either way, the result is the same and all of the gutter cells return with 0 widths once again. Despite the 0 width, each gutter cell appears to be sized according to its contents (see the first and third pictures in the above comments).
New Date Selected
Since the individual gutter cells now have individual widths but width
is still 0 from this._gutterWidth
being 0 in the previous render, the initial resize is skipped.
This time, this._gutterWidth
has something to play with and uses the Math.max
of [ 69.234375, 10, 48 ]
.
Since this._gutterWidth
now has an actual width set to it, the next line of if (this._gutterWidth && width !== this._gutterWidth)
is successful, and the new width is set on each of the gutters. This displays correctly, as in image 2 above.
Select Another Date
If you select another date after that, width
has a non-zero value this time, so the initial check to reset the gutter sizes runs and does reset the sizes.
this._gutterWidth
again chooses the same max value from the same array of gutterCells
, that all still show the same widths as before.
In the check for if (this._gutterWidth && width !== this._gutterWidth)
, width
& this._gutterWidth
are equal, so the gutter cell sizes never get re-set back to this._gutterWidth
. This is most likely the source of the "Select another date" issue, as they are reset to 0, then never subsequently re-set to the proper value.
This causes the gutter cells to appear as they did originally, with each adhering to the width of its contents, as opposed to nice and even.
Let me know if this doesn't make sense, or if you need more details. I appreciate the work you have done already, and the work you are putting in to assist with this issue.
from react-big-calendar.
Related Issues (20)
- Agenda view customizations HOT 3
- Issue Displaying the Calendar within vite react app HOT 2
- Wrong range of dates on WorkWeek view when using Timezones HOT 5
- DnD addon: specify a resizing step distinct from the calendar step HOT 1
- Shift + drag & drop broken on windows
- Custom view for day view getting error HOT 7
- Incorrect events appearance after navigation back & next HOT 3
- Month View: events not rendering for the last day of the week. HOT 5
- ERROR in ./node_modules/react-big-calendar/dist/react-big-calendar.esm.js 6:0-62 HOT 11
- Incorrect Calendar display and missing dates in 'month' view when using dayjsLocalizer - March 2024 HOT 3
- Drag selection not working properly when moving upwards HOT 3
- Incorrect date passed to onSelectSlot (and onSelecting) HOT 7
- [Accessibility] "Ensure elements with ARIA role that require child roles contain them HOT 1
- Wrong possition for current time indicator HOT 1
- Node modules manipulation for custom week view HOT 2
- CSS inside the component HOT 1
- Limit events shown per day in calendar (Month view) HOT 1
- For Month view event does not come back if its undroppable (e.g we try to move it outside the calender) HOT 3
- Detecting right Click or any Click inGeneral HOT 1
- onSelectSlot start date is from the start of the day, not where I start the selection (in week view) HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-big-calendar.