react-date-range icon indicating copy to clipboard operation
react-date-range copied to clipboard

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

Open danyalg opened this issue 2 years ago • 8 comments

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

danyalg avatar Sep 13 '21 15:09 danyalg

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.

kamyar avatar Sep 13 '21 15:09 kamyar

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

danyalg avatar Sep 13 '21 15:09 danyalg

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} ?

kamyar avatar Sep 13 '21 20:09 kamyar

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.  

qxFisher avatar Sep 14 '21 08:09 qxFisher

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}.

danyalg avatar Sep 14 '21 08:09 danyalg

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

#516

qxFisher avatar Sep 14 '21 11:09 qxFisher

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

peternic avatar May 23 '22 12:05 peternic

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

PhongLi avatar Oct 05 '23 11:10 PhongLi