darkokoa / datetime-wheel-picker

Wheel Date & Time Picker in Compose Multiplatform
102 stars 4 forks source link

Weird snapping behavior on Android #23

Closed JSMonk closed 1 month ago

JSMonk commented 1 month ago

Version: 1.0.1-compose1.7-beta01 Kotlin: 2.0.20 Compose plugin: 1.7.0-beta01

I'm using the library on Android and iOS, and I realized that the snap action is weird on Android.

// The usage
val width =  LocalConfiguration.current.screenWidthDp.dp
var selectedDate by remember { mutableStateOf(LocalDate.now()) }
WheelDatePicker(
    startDate = selectedDate,
    modifier = Modifier.fillMaxWidth(),
    textStyle = MaterialTheme.typography.h4,
    textColor = MaterialTheme.colors.primary,
    rowCount = 7,
    size = DpSize(width = width, height = 245.dp),
    selectorProperties = WheelPickerDefaults.selectorProperties(
        shape = RoundedCornerShape(8.dp),
        color = MaterialTheme.colors.selectedDate,
        border = null
    ),
    onSnappedDate = { selectedDate = it }
)

https://github.com/user-attachments/assets/7ed61c8f-dea7-475c-91cf-86bc10d44626

darkokoa commented 1 month ago

Thank you for reporting this issue. I have been able to reproduce it and am currently working on a fix.

darkokoa commented 1 month ago

After checking, I found that this issue occurs on all platforms.

darkokoa commented 1 month ago

Fixed it in v1.0.2

JSMonk commented 1 month ago

@darkokoa Could you please also publish the version for the compose 1.7.0-beta01?

darkokoa commented 1 month ago

@JSMonk OK, use v1.0.2-compose1.7.0-beta01