react-native-date-picker icon indicating copy to clipboard operation
react-native-date-picker copied to clipboard

onDateChange not updating fast enough, reverts to previous state upon not being able to register the scroll-select (iOS)

Open Guide4Ever opened this issue 4 years ago • 1 comments

Issue

onDateChange function is not updating fast enough. Sometimes when I quickly scroll and select let say 4 numbers (sequentially), the last (in our case 4th value) is not registered thus reverting back to the 3rd. That occurs with each scroll wheel separately. It's not an issue of combined scrolling of i.e. days and months. Individual scroll picker inherits this issue.

The last value upon fast scroll-select does not get updated/ registered by onDateChange function, it locks to the previous state. (short explanation).

Expected Behavior

Should register the last value even if it's being fast scrolled.

Code

      <DatePicker
        scrollRef={scrollRef}
        mode="time"
        date={date}
        locale="en"
        open={pickerOpen}
        onDateChange={changeFunction}
        minuteInterval={15}
      />

Environment

  1. react-native -v: 0.66.1
  2. node -v: v16.13.0
  3. npm -v: 8.1.0
  4. target platform: iOS (could be Android too, haven't tested there yet)
  5. operating system: macOS (emulator Xcode)

Guide4Ever avatar Feb 09 '22 12:02 Guide4Ever

Hi, thanks for reporting this. Could you provide a video where this happens?

henninghall avatar Feb 12 '22 17:02 henninghall

same problem here

DanielZyger avatar Oct 22 '22 14:10 DanielZyger

A very similar thing is happening to me. I'm using the modal date & time pickers. When the confirm button is clicked too soon, it calls onConfirm with the original date. This is happening on both iOS and Android. I've attached a screen recording of it happening on the iOS simulator. I'm using the latest version, 4.2.6.

https://user-images.githubusercontent.com/65209071/212437881-341ab122-cfdb-4020-b62d-13988891bb58.mov

kollinmurphy avatar Jan 13 '23 23:01 kollinmurphy

This should be expected behavior.

on iOS:

  • (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { }

does not happen until the picker stops moving... I'm assuming it's the same in Android (but unsure)

DevGW avatar Jan 29 '23 17:01 DevGW

It's happening on Android as well. Quite confusing when it happens during regular use.

dcdavidheisnam avatar Apr 19 '23 05:04 dcdavidheisnam

onDateChange is firing late even when the animation has stopped. For example, when I switch AM to PM, it takes a whole second before the onDateChange is fired. This really breaks the user experience because we're going to have to expect the user to wait before clicking on Save or Confirm.

dcdavidheisnam avatar Apr 19 '23 05:04 dcdavidheisnam

Let's keep the discussions around this problem in this issue,

henninghall avatar Apr 19 '23 18:04 henninghall