This seems like a really good alternative to react-datepicker cos it provides custom styling. However, a simple setup following the documentation does not work. The styles do not load. I'm using it with redux-form; the styling is just broken. Anyone else having this issue?
Have you read this first? http://react-day-picker.js.org/docs/styling.html
If there鈥檚 something not clear, I鈥檒l be happy to help!
Yes I read that. The documentation is very clear actually but my implementation does not work.
import React, { Component } from 'react'
import DayPickerInput from 'react-day-picker/DayPickerInput'
import 'react-day-picker/lib/style.css'
class DateTextField extends Component {
renderField ({ label }) {
return (
<div>
<span>{label}</span>
<DayPickerInput />
</div>
)
}
render () {
const { name, label } = this.props
return (
<Field name={name} component={this.renderField} label={label} />
)
}
}
export default DateTextField
Any ideas?
So when I added <link rel="stylesheet" href="https://unpkg.com/react-day-picker/lib/style.css"> in the <head> tag, it worked. Not sure what's happening.
@adred I think there's a problem in the way you import CSS from JavaScript:
import 'react-day-picker/lib/style.css'
Are you sure that the CSS is actually imported? E.g. using css-loader and included it in your final CSS file?
i am also facing the same issue
@shivam16parashar any luck, facing same issue
I just met the same problem.
And the solution below is work for me.
import "./Calendar.sass";
import the style.css form node_modules.
@import "../../../../../node_modules/react-day-picker/lib/style";
Most helpful comment
So when I added
<link rel="stylesheet" href="https://unpkg.com/react-day-picker/lib/style.css">in the<head>tag, it worked. Not sure what's happening.