googlemaps / googlemaps/android-maps-compose
Jetpack Compose Map throwing this when TalkBack is turned on. -> java.lang.IllegalStateException: LayoutNode should be attached to an owner
- Vorherrschende Sprache
- Kotlin
- Sterne
- 1.3k
- Forks
- 181
- Ø Merge
- 2 T. 23 Std.
- Gemergte PRs (30 T.)
- 18
Beschreibung
Library version and other environment information
```
composeBOMVersion = "2023.06.01"
composeCompilerVersion="1.4.0-alpha02"
composeNavigationVersion = "2.5.3"
implementation 'com.google.maps.android:maps-compose:2.14.1'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
```
#### Steps to reproduce
Turn on Talk back and Navigate to This compose
When TalkBack is turned off, the app works as expected
Crash Report

Code:
```
@Composable
fun LocationPickerScreen(
uiState: LocationPickerScreenContract.UiState,
) {
val configuration = LocalConfiguration.current
val screenHeight = configuration.screenHeightDp.dp
val currentLoc = uiState.locationInfo.addressLatLng
val cameraState = rememberCameraPositionState()
LaunchedEffect(key1 = currentLoc) {
cameraState.centerOnLocation(currentLoc)
}
val marker = LatLng(currentLoc.latitude, currentLoc.longitude)
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
) {
Box(
modifier = Modifier.fillMaxSize()
) {
GoogleMap(
modifier = Modifier
.fillMaxWidth()
.height(screenHeight - 300.dp)
.align(Alignment.TopCenter),
cameraPositionState = cameraState,
properties = MapProperties(
isMyLocationEnabled = true,
mapType = MapType.HYBRID,
isTrafficEnabled = true
)
) {
Marker(
state = MarkerState(position = marker),
title = "MyPosition",
snippet = "This is a description of this Marker",
draggable = true
)
}
Column(
modifier = Modifier
.fillMaxWidth()
.height(308.dp)
.align(Alignment.BottomCenter),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
Text(
text = "Data Place Holder",
modifier = Modifier
.semantics {
contentDescription = "data"
}
.padding(bottom = 8.dp),
style = MaterialTheme.typography.body2.copy(
fontSize = 14.sp,
fontWeight = FontWeight.SemiBold,
lineHeight = 16.sp
),
)
}
}
}
}
private suspend fun CameraPositionState.centerOnLocation(
location: LatLng
) = animate(
update = CameraUpdateFactory.newLatLngZoom(
location,
15f
),
durationMs = 1500
)
```

Beitragsleitfaden
Rechercherichtung
Beginne damit, den Absturz im bereitgestellten LocationPickerScreen bei aktiviertem TalkBack zu reproduzieren, wobei du dich auf das GoogleMap composable und seinen Marker konzentrierst. Vergleiche das Verhalten bei deaktiviertem TalkBack; als erledigt gilt die Aufgabe, wenn die Navigation unter den gemeldeten Compose- und Maps Compose-Versionen nicht mehr die LayoutNode attachment exception auslöst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- android, kotlin
- Bereich
- accessibility, mobile
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 35/100