react-dates icon indicating copy to clipboard operation
react-dates copied to clipboard

how can I make date scroll up and down when use orientation and numberOfMonths

Open meicx opened this issue 5 years ago • 3 comments

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/) image

meicx avatar Apr 15 '19 13:04 meicx

Did you ever figure this out?

mparker11 avatar Jul 19 '19 00:07 mparker11

@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

mmarkelov avatar Jul 19 '19 09:07 mmarkelov

#1258

Fluorz avatar Jun 14 '22 17:06 Fluorz