Time picker sometimes resets value to previous value after change
See original GitHub issueBug report
👋 Hello!
Summary
When using the Time mode, the value seems to jump to a previously selected value. I am using the iOS Simulator and have not been able to test it on a real device yet.
Environment info
System:
OS: macOS 10.15.5
CPU: (16) x64 AMD Ryzen 7 1700X Eight-Core Processor
Memory: 1.32 GB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.18.0 - ~/.nvm/versions/node/v12.18.0/bin/node
Yarn: 1.22.4 - ~/.nvm/versions/node/v12.18.0/bin/yarn
npm: 6.14.4 - ~/.nvm/versions/node/v12.18.0/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
IDEs:
Xcode: 11.5/11E608c - /usr/bin/xcodebuild
npmPackages:
react: ~16.9.0 => 16.9.0
react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4
Library version: 2.2.2
Steps to reproduce
- Use DateTimePickerModal with mode=“time”
- Change minute value to say 25
- Change it to say 50
- Every now and then the time picker will reset the minute value to 25
Reproducible sample code
I have videos, but they are not very clear since they do not the pointer intent very well, it looks like I could just be dragging down again. I’ll work on providing more info.
Code used
const TimePicker = () => {
const [isDatePickerVisible, setDatePickerVisibility] = useState(false)
const [time] = useState(() => new Date())
const showDatePicker = () => {
setDatePickerVisibility(true)
}
const hideDatePicker = () => {
setDatePickerVisibility(false)
}
const handleConfirm = (date: Date) => {
hideDatePicker()
console.log('date is', date)
}
return (
<>
<Button onPress={showDatePicker} title="Show date" />
<DateTimePickerModal
isVisible={isDatePickerVisible}
testID="dateTimePicker"
date={time}
mode="time"
onConfirm={handleConfirm}
onCancel={hideDatePicker}
/>
</>
)
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:18 (3 by maintainers)
Top Results From Across the Web
Time picker sometimes resets value to previous value after ...
Bug report Hello! Summary When using the Time mode, the value seems to jump to a previously selected value. I am using the...
Read more >Datetimepicker value resets on incorrect submit and page ...
I want the value of the datetimepicker to persist on page refresh, and not be reset to default. The value (:deadline) is stored...
Read more >Set Date time picker value to Previous value - MSDN - Microsoft
hi. I have Date time picker control for that I have created ValueChanged event. I am checking changed value with database if suppose...
Read more >Reset timepicker lable to match time token values
My question is: How can I reset the timepicker Label text to match the radio button selected time range? Currently, if a user...
Read more >Forms in HTML documents - W3C
A control's initial value does not change. Thus, when a form is reset, each control's current value is reset to its initial value....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same issue, experiencing in “time” mode. Pasting below a gif to demonstrate - I am changing the hour from 00 to 03 as expected and then trying to change the minute from 00 to 58, where when I release my mouse (or finger when testing on a real device) it snaps back to the previous value.
The issue only seems to happen when I change a value shortly after a previous change, before it has had a chance to “settle in”. Help would be much appreciated!
🎉 This issue has been resolved in version 2.6.1 🎉
The release is available on:
Your semantic-release bot 📦🚀