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.

datepicker styles are not loaded - class="undefined"

See original GitHub issue

There seems to be some issue with loading css modules. I’m importing react-persian-datepicker as follows:

import { DatePicker } from 'react-persian-datepicker';

and I’m using <DatePicker/> is my component. I’m also using css-loader and style-loader as stated in the docs:

Note that you need css-loader for /.css$/ files enabled to have the styles working as we use css modules to put classnames in place.

my webpack config module section:

{
  test: /\.css$/,
  exclude: /node_modules/,
  loader: 'style-loader!css-loader?modules&importLoaders=1',
},
{
  test: /\.css$/,
  include: /node_modules/,
  loader: 'style-loader!css-loader',
},

Any idea how to fix this?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

8reactions
basircommented, Jun 13, 2018

Fix it like this:

const styles= {
    calendarContainer: 'calendarContainer',
    dayPickerContainer: 'dayPickerContainer',
    monthsList: 'monthsList',
    daysOfWeek: 'daysOfWeek',
    dayWrapper: 'dayWrapper',
    selected: 'selected',
    heading: 'heading'
}
      <DatePicker calendarStyles={styles}/>
3reactions
asiyecommented, Aug 1, 2018

const styles= { calendarContainer: ‘calendarContainer’, dayPickerContainer: ‘dayPickerContainer’, monthsList: ‘monthsList’, daysOfWeek: ‘daysOfWeek’, dayWrapper: ‘dayWrapper’, selected: ‘selected’, heading: ‘heading’, next:‘next’, prev:‘prev’, title:‘title’, } <Calendar styles={ styles } /> <DatePicker calendarStyles={ styles } />

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-datepicker styles are not being not applied on deployed ...
I'm using the react-datepicker npm module and its styles got broke (styles are not being applied) when I deploy the build, it's working...
Read more >
react-datepicker - npm
A simple and reusable datepicker component for React. Latest version: 4.8.0, last published: 7 months ago. Start using react-datepicker in ...
Read more >
Date picker not working. Only showing input field
I figured out the reason. Loading of styles and scripts occurs if the content ($post->post_content) contains a shortcode ([salon/] etc.). But if the...
Read more >
SharePoint 2013 Datepicker Not Rendering Correctly
I have all my styles/layouts/css/js in a separate folder in the masterpage folder. I have this working on one site collection, but for...
Read more >
css is not applying for the date picker in my inner jsp
Hi, I am using date picker in my JSP as below. <input type="text" id="d1" class="inputbox datepicker" /> which is working fine with in...
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