I have a simple Slider below with a customised thu...
# compose
e
I have a simple Slider below with a customised thumb. When I don't have
.clickable
, every works fine. However, when I have
.clickable
, the first click and drag on the thumb will reset the value of slider to 0 as illustrated in the gif shared. Note • Just click without dragging, it's fine • This happened only on the first click and drag.
Copy code
Slider(
            value = ....
            thumb = {
                Spacer( modifier = Modifier
                    .clickable {}
                    ...
                )
            }
        )
Why is that happening? Did I miss something, or this is a Compose's bug? If this is a Compose's bug, is there a workaround (to detect the thumb is clicked, without using
.clickable
)? I have also post on StackOverflow with the complete code that can reproduce this issue. Thanks!!
Highly suspect this is a Google Bug. Filing Issue in https://issuetracker.google.com/issues/321145564
o
your issue might lie here where it is tring to dispatch a raw delta of 0
Copy code
pointerInput(state, interactionSource) {
        detectTapGestures(
            onPress = { state.onPress(it) },
            onTap = {
                state.dispatchRawDelta(0f)
                state.gestureEndAction()
            }
        )
    }