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.

CSS class names no longer working with 20.3.0

See original GitHub issue

react-dates version react-dates@20.3.0

Describe the bug A project that was working with 20.2.5 using react-dates/initialize to get old-school class names is no longer working after upgrading to 20.3.0. Appears to be this PR: https://github.com/airbnb/react-dates/pull/1758

Now getting the Cannot read property 'createLTR' of undefined like you got in the past if you didn’t use initialize.

Maybe this just needs documentation? Not sure what it meant by “css injected prop”

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ljharbcommented, Sep 3, 2019

It might be that webpack’s automatic bundle splitting isn’t consistently deduping both react-dates and react-with-styles?

1reaction
norataranocommented, Aug 29, 2019

@mstanaland The “css injected prop” refers to the css prop that withStyles()(Component) injects into components it wraps from react-with-styles. This is the framework that’s used for styling all react-dates components. Internally withStyles looks something like this (simplified for brevity):

const { css, styles, theme} = withStylesProps();
return (
  <WrappedComponent
    {...this.props}
    {...{
      css,
      styles,
      theme,
    }}
  />
);

So there’s no need to import css directly, especially not from within react-dates components. This ensures that the css function used is the one that’s been registered through ThemedStyleSheet.registerInterface(), which in turn is what should be called by react-dates/initialize.

Update: ~I’m looking at that function right now and I’m not seeing any calls to ThemedStyleSheet.registerInterface(), which explains why you’re getting the error Cannot read property 'createLTR' of undefined, since createLTR is accessed from that object that is undefined.~ (I confused the theme with the interface). It’s definitely registering the CSSInterface.

What surprises me is that this error wasn’t happening before. Can you share the complete trace for that error?

cc @ljharb

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS class names no longer working with 20.3.0 #1766 - GitHub
A little more investigation on my part has me thinking the issue is likely at least partly our setup. We have react-dates in...
Read more >
CSS class starting with number is not getting applied
The reason for this is that "CSS identifiers" may not start with numbers. In CSS, class names used in selectors are considered "CSS...
Read more >
Loops in CSS Preprocessors | CSS-Tricks
Preprocessor loops will not cause dramatic explosions in space (I hope) ... by looping through a simple list of colors, to see how...
Read more >
Intellisense does not show up for css style class names in ...
I just open visual studio 2022 preview, then open an existing project or create a new one. When I start typing class value...
Read more >
nth-of-type() - CSS: Cascading Style Sheets - MDN Web Docs
The :nth-of-type() CSS pseudo-class matches elements based on their ... The second paragraph has a class of fancy but is not matched as...
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