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
- Lingua principale
- Kotlin
- Stelle
- 1.3k
- Fork
- 181
- Merge medio
- 2g 23h
- PR unite (30g)
- 18
Descrizione
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
)
```

Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia riproducendo il crash nel LocationPickerScreen fornito con TalkBack abilitato, concentrandoti sul composable GoogleMap e sul relativo Marker. Confronta il comportamento con TalkBack disabilitato; il lavoro è completato quando la navigazione non genera più la LayoutNode attachment exception con le versioni di Compose e Maps Compose indicate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- android, kotlin
- Ambito
- accessibility, mobile
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100