hypeserver / react-date-range

A React component for choosing dates and date ranges.
MIT License
2.59k stars 679 forks source link

Is there any props can stop jumping to start date after selecting endDate #515

Open danyalg opened 3 years ago

danyalg commented 3 years ago

Subject of the issue

Currently when we select start Date and end Date , the calendar will scroll or jump to start date. This is kind of confusing for some people to see what happening after selecting end Dat.

Do we have any option to stop this behaviour?

[BUG] Bug Reproduce Steps

  1. Select start date
  2. Select end date
  3. View will scroll to start date

[BUG] Expected behaviour

  1. Select start date
  2. Select end date
  3. View remain on end Date

Environment

Package Version: lates React version: 17.0.1 Node version: 14.0 Browser: Any

kamyar commented 3 years ago

Hey, can you take a look into 1.4.0, we release https://github.com/hypeserver/react-date-range/pull/428 that fixes https://github.com/hypeserver/react-date-range/issues/427 , I guess this is a duplicate of that.

danyalg commented 3 years ago

Thanks @kamyar , I am using it with scroll propc(vertical mode) , however in release note mentioned "allow prevention of unnecessary refocus on selection of a date in viewing range (for non-scrolled calendars)".

Also could you please mentioned what exactly need to pass to disable this auto focus ?

Thanks

kamyar commented 3 years ago

I could not find

allow prevention of unnecessary refocus on selection of a date in viewing range (for non-scrolled calendars)

Can you link to it?

can you try passing preventSnapRefocus={true} ?

qxFisher commented 3 years ago

Hey guys!

I faced the same problem with scrolling to the start date after selecting the date period.

preventSnapRefocus={true} - this only fixed unnecessary scroll to the left side of the 2-month calendar when we tried to select a date on the right side.

So it would be really great if we could remove the scroll of the calendar on any date interaction.  

danyalg commented 3 years ago

n you link to it?

Hi , Sure this is link of release notes [https://github.com/hypeserver/react-date-range/pull/428]

also I am using DateRange , for some reason show type error, (version 1.4.0) image

for preventSnapRefocus={true}.

qxFisher commented 3 years ago

I created simple PR with an additional prop to prevent any unnecessary month jumpings

516

peternic commented 2 years ago

Hi, getting the same problem in v1.4.0. Is there a solution for this? Thanks!

PhongLi commented 1 year ago

any solution yet? preventSnapRefocus={true} not work for daterange