react-dates
react-dates copied to clipboard
how can I make date scroll up and down when use orientation and numberOfMonths
I see the props and examples only show It can scroll down when set orientation="verticalScrollable" and numberOfMonths={number}. but how can I scroll to prev month? (eg. I want to show March 2019 、February 2019 when scroll up, like http://clauderic.github.io/react-infinite-calendar/)
Did you ever figure this out?
@meicx @mparker11 as it is not implemented now. I can advice you some workaround - it is very bad solution :(
componentDidMount() {
// Very bad
// Find start date to scroll to it, do not now how to do it in right way
// So I only got strong text of it
const scrollElem =
[...document.getElementsByTagName('strong')].find(
el => el.textContent === 'July 2019',
);
scrollElem.scrollIntoView();
}
...
<DayPickerRangeControllerWrapper
...
orientation="verticalScrollable"
numberOfMonths={10}
// Set initial start date
initialStartDate={moment().subtract(5, 'months').startOf('month')}
verticalHeight={800}
/>
...
I suppose it can be implemented in library, but I don't know what should be API looks like
#1258