Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Balloon Position within BottomSheet and LazyColumn, especially during Scrolling #792

Open
msseodev opened this issue Feb 28, 2025 · 1 comment

Comments

@msseodev
Copy link

  • Library Version: 1.6.12
  • Affected Device(s): Tested on Samsung SM-F741N(zFlip)

Describe the Bug:
The position of the balloon tooltip is not accurately maintained, particularly during scrolling. As demonstrated in the attached video, the balloon's position deviates from its intended anchor point, becoming inaccurate especially when scrolling within a LazyColumn that is nested inside a BottomSheet. This positional inaccuracy is more pronounced during scrolling and when the BottomSheet is not fully expanded or is in the process of being dismissed/collapsed.

issue-bollon-position.mp4

Minimal repoduce

    var balloonWindow: BalloonWindow? by remember { mutableStateOf(null) }
    BottomSheetScaffold(
        sheetContent = {
            LazyColumn(
                modifier = Modifier
                    .fillMaxWidth()
                    .background(color = Color.Cyan)
            ) {
                items(50) { index ->
                    Box(
                        modifier = Modifier
                            .fillMaxWidth()
                            .height(100.dp)
                            .background(if (index % 2 == 0) Color.Blue else Color.Yellow)
                    ) {
                        if(index == 1) {
                            Balloon(
                                builder = rememberBalloonBuilder {
                                    setArrowSize(10)
                                    setArrowPosition(0.5f)
                                    setArrowPositionRules(ArrowPositionRules.ALIGN_ANCHOR)
                                    setWidth(BalloonSizeSpec.WRAP)
                                    setHeight(BalloonSizeSpec.WRAP)
                                    setPadding(12)
                                    setCornerRadius(12f)
                                    setBackgroundColor(android.graphics.Color.MAGENTA)
                                    setDismissWhenTouchOutside(false)
                                },
                                onBalloonWindowInitialized = { balloonWindow = it },
                                onComposedAnchor = { balloonWindow?.showAlignTop() },
                                balloonContent = {
                                    Text(
                                        text = "I am balloon tooltip!"
                                    )
                                },
                                content = {
                                    Text("Item $index")
                                }
                            )
                        } else {
                            Text("Item $index")
                        }
                    }
                }
            }
        }
    ) { padding ->
        Box(modifier = Modifier.padding(padding))
    }

Expected Behavior:
The balloon tooltip should remain consistently anchored to its designated anchor point at all times, including during scrolling and regardless of the BottomSheet's visibility or expansion state. It should not lose its correct position relative to the anchor element when the content within the LazyColumn is scrolled or when the BottomSheet is being interacted with.

@UndercoverOp
Copy link

I am experiencing the same issue with a scrollable column, seems like the balloon always wants to stay on the screen instead of being pinned to its content within the column. Is there anything we are missing to make the balloon stay within the scrollable content @skydoves ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants