Skip to content

Setting isInteractive = false to the view still consumes events #6

@alexstyl

Description

@alexstyl

I would like to be able to set interactivity modifiers to SnizzorsUIView so that I can move the view around with touch gestures.

It seems like even if I set interactivity to false, the UiKitView still consumes the events.

It would be great to be great to be able to use it. Potentially possible to make proper use of Liquid Glass with this technique.

My code:

@Composable
fun InteractiveView() {
    var offsetX by remember { mutableStateOf(0f) }
    var offsetY by remember { mutableStateOf(0f) }
    SnizzorsUIView(
//    UIKitView(
        properties = UIKitInteropProperties(
            isInteractive = false,
            isNativeAccessibilityEnabled = false
        ),
        modifier = Modifier
            .offset { IntOffset(offsetX.roundToInt(), offsetY.roundToInt()) }
            .pointerInput(Unit) {
                detectDragGestures { change, dragAmount ->
                    change.consume()
                    offsetX += dragAmount.x
                    offsetY += dragAmount.y
                }
            }.border(1.dp, Color.Red).size(48.dp),
        factory = {
            UIVisualEffectView()
        }
    )
}

PS: If i replace the SnizzorsUIView with UIKitView interactivity works, but then I lose the transparency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions