mapbox / mapbox/mapbox-maps-android
Using scrollable columns with ViewAnnotation (Compose)
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 578
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
Environment
- Android OS version: 16
- Devices affected: all
- Maps SDK Version: 11.9.2
Observed behavior and steps to reproduce
Add scrollable "Column" or "LazyColumn" to ViewAnnotation as content.
Map consume all columns scrolling events.
Expected behavior
ViewAnnotation with scrollable views inside work correctly like it is done on iOS.
Notes / preliminary analysis
Map consume all columns scrolling events.
Possible workaround:
Box(
modifier = modifier
.width(mapBalloonWidth)
.padding(marginVerySmall)
.clickable(onClick = onDismiss)
.pointerInput(Unit) {
awaitPointerEventScope {
while (true) {
val event = awaitPointerEvent()
var verticalDelta = 0f
event.changes.forEach {
if (it.positionChanged()) {
verticalDelta += it.positionChange().y
it.consume()
}
}
if (verticalDelta != 0f) {
scrollScope.async {
scrollState.scrollBy(-verticalDelta)
}
}
}
}
},
contentAlignment = Alignment.Center,
) {
Column(modifier = Modifier.verticalScroll(state = scrollState))
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with a scrollable Column or LazyColumn inside a Compose ViewAnnotation on Android 16 using Maps SDK 11.9.2, then compare the event handling with the provided pointerInput workaround. Done means scroll gestures inside the ViewAnnotation work correctly without the map consuming them, matching the stated iOS behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100