Open jamstooks opened 5 years ago
I just encountered this as well. I'm using CSS-in-JS (styled-components
). The same thing happens when using usePortal
and useFullscreenPortal
.
I don't think react-dates
can do anything different here. The portal is outside of your app. It has to be. Otherwise your app could be apply styles that would prevent it from aligning properly on the screen.
You can solve this styling issue by having base styles that apply to body
, or by targeting the react-dates
portal specifically.
All I had to add (to my already prodigious react-dates
CSS override file) was this:
.DateRangePicker_picker__portal {
font-family: Roboto, sans-serif;
}
react-dates version react-dates@20.2.4
Describe the bug When setting
withFullScreenPortal
totrue
, I'm finding that I'm getting a fall-back serif font.I believe this is because the portal renders at the bottom of
<body>
. I'm using a css-in-js approach and my global styles are not available outside of the app rendered in<div className="App">
.Is this a bug or is there a way I should wrap the portal with my app's styles?
Source code (including props configuration)
https://codesandbox.io/s/react-dates-full-screen-portal-styles-36y6q
Screenshots/Gifs
Here, a full-screen portal show serif...
while the vertical pop-over shows sans-serif:
Desktop (please complete the following information):