Skip to content

"CameraPositionState may only be associated with one GoogleMap at a time" when used with Accompanist's HorizontalPager #106

Description

@nathanjde

Coming across a crash when trying to embed a GoogleMap inside a HorizontalPager when the CameraPositionState is hoisted outside of the pager

Environment details

  • Android Studio Bumblebee 2021.1.1 Patch 3
  • Kotlin 1.6.20
  • Compose 1.2.0-alpha08
  • Accompanist 0.24.7-alpha
  • maps-compose 2.1.0

Steps to reproduce

Stack trace

java.lang.IllegalStateException: CameraPositionState may only be associated with one GoogleMap at a time
    at com.google.maps.android.compose.CameraPositionState.setMap$maps_compose_release(CameraPositionState.kt:144)
    at com.google.maps.android.compose.MapPropertiesNode.<init>(MapUpdater.kt:40)
    at com.google.maps.android.compose.MapUpdaterKt$MapUpdater$1.invoke(MapUpdater.kt:121)
    at com.google.maps.android.compose.MapUpdaterKt$MapUpdater$1.invoke(MapUpdater.kt:119)
    at com.google.maps.android.compose.MapUpdaterKt$MapUpdater$$inlined$ComposeNode$1.invoke(Composables.kt:225)
...

Metadata

Metadata

Assignees

Labels

releasedtriage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions