| Tech | Version |
| -------------------- | ------- |
| @material-ui/pickers | v4.0.0-alpha7 |
| material-ui | v4.10.0 |
| TypeScript | No |
| React | 16.13.1 |
| Browser | Chrome |
| Peer library | moment |
import React, { useState } from 'react'
import classNames from 'classnames'
import { StaticDateRangePicker as DateRangePicker, Day } from '@material-ui/pickers'
import { makeStyles } from '@material-ui/core/styles'
import TextField from '@material-ui/core/TextField'
import moment from 'moment'
const useStyles = makeStyles((theme) => ({}))
const StaticDateRangePicker = (props) => {
const classes = useStyles()
return (
<DateRangePicker
autoOk
orientation="portrait"
variant="static"
openTo="date"
disableOpenPicker
value={props.range}
onChange={(newRange) => {
props.onChangedDate(newRange[0], newRange[1] ? newRange[1] : newRange[0])
}}
showTodayButton
disableFuture
views={['date']}
renderInput={(startProps, endProps) => (
<>
<TextField {...startProps} />
<TextField {...endProps} />
</>
)}
renderDay={(day, selectedDates, DayComponentProps) => console.log("I'm a sailor")}
/>
)
}
export { StaticDateRangePicker }
Calling Component
render() {
<StaticDateRangePicker
range={[moment().subtract(1, "day"), moment()]}
onChangedDate={(dateA, dateB) => {
this.onSetDateRange(dateA, dateB)
}} />
}
Expect my dream career title to be logged to the console
Appears the custom renderDay prop is being ignored, or some condition is overruling the default renderDay method
Anyone else seeing this?
You import StaticDateRangePicker, it contains the content of the popup, it's isolated from the inputs.
@oliviertassinari I'm sorry, I don't believe you answered the question...
There is a render method (renderDay) which allows us to make custom day components. It is called correctly on the static day picker, it is not being called on the static day range picker where the documentation says it is a prop.
I'm not referring to the renderInput method. Can you reopen or at least address this please?
Please provide a minimal reproduction test case. This would help a lot 馃懛 .
A live example would be perfect. This codesandbox.io template _may_ be a good starting point. Thank you!
@oliviertassinari
Note the renderDay method not being called
https://codesandbox.io/s/reverent-faraday-fs49n?file=/src/App.jsx