googlemaps / googlemaps/android-maps-compose

GeoJson breaks marker listener

Open
#530 1 comment 5 reactions 0 assignees View on GitHub
priority: p1 type: bug
Dominant language
Kotlin
Stars
1.3k
Forks
181
Avg merge
2d 23h
Merged PRs (30d)
18

Description

#### Environment details

1. Specify the API at the beginning of the title (for example, "Places: ...")
Maps compose
3. OS type and version
Any version
5. Library version and other environment information
4.3.3

#### Steps to reproduce

When loading a geoJson layer the click listeners for the MarkerComposable stops working

#### Code example

```
GoogleMap(
modifier = Modifier.fillMaxSize(),
cameraPositionState = cameraPositionState
) {
val context = LocalContext.current
MarkerComposable(state = MarkerState(position = LatLng(1.35, 103.87)), onClick = {
Toast.makeText(context, "marker clicked!!", Toast.LENGTH_SHORT).show()
true
}) {
Box(modifier = Modifier
.size(32.dp)
.background(color = Color.Blue))
}
MapEffect(key1 = "12313", block = { map ->

val layer = GeoJsonLayer(map, R.raw.anyjson, context)

layer.setOnFeatureClickListener { feature ->
Toast.makeText(context, "Map layer feature clicked", Toast.LENGTH_SHORT)
}

layer.addLayerToMap()
})
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.