-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
While using the WheelTimePicker within an AnimatedVisibility, I noticed that the onTimeChangeListener would initially return the current time before returning the inputted startTime. This caused a flickering effect in my TextField used to display the selected time.
Implementation is shown below:
AnimatedVisibility(
modifier = Modifier.align(Alignment.CenterHorizontally),
visible = expanded,
enter = expandVertically(),
exit = shrinkVertically()
) {
WheelTimePicker(
height = 212.dp,
timeFormat = TimeFormat.AM_PM,
hideHeader = true,
startTime = time,
rowCount = 7,
onTimeChangeListener = {
println("onTimeChangeListener: $it")
time = it
}
)
}
This produced the behavior shown in the following screen recording along with the print statements from within the onTimeChangeListener:
Screen.Recording.2025-09-30.at.1.06.09.PM.mov
onTimeChangeListener: 13:06:12.462928
onTimeChangeListener: 06:30
onTimeChangeListener: 13:06:14.114808
onTimeChangeListener: 06:30
onTimeChangeListener: 13:06:15.899738
onTimeChangeListener: 06:30
From first glance this may be fixed easily by initializing state variable selectedDate to the startTime on line 82 of WheelTimePickerComponent.kt
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels