Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elements inside MarkerInfoWindow can't handle Click events #541

Open
dreson00 opened this issue Mar 31, 2024 · 4 comments
Open

Elements inside MarkerInfoWindow can't handle Click events #541

dreson00 opened this issue Mar 31, 2024 · 4 comments
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@dreson00
Copy link

Button inside MarkerInfoWindow can't handle click events because the window handles them. There should be an option to disable this so we can have buttons and other clickable elements inside info windows.

There is a similar issue closed with this comment:

Closing this issue, MarkerInfoWindow can handle ClickEvents:

   MarkerInfoWindow(
                state = rememberMarkerState(position = LatLng(1.35, 103.87)),
                onClick = {
                    Log.d("Hi", "I am a click event")
                    true
                }
            )

Originally posted by @kikoso in #200 (comment)

But this answer doesn't solve the problem at all. The onClick parameter is for the marker, not the window and the onInfoWindowClick: (Marker) -> Unit = {} parameter doesn't allow us to return Boolean.

Version

maps-compose version 4.3.0

Steps to reproduce

  1. Create a MarkerInfoWindow with a Button as content

Code example

MarkerInfoWindow(
    state = rememberMarkerState(
        position = LatLng(0.0,  0.0)
    ),
) {
    Text("Title")
    Button(
        onClick = {
            // do something
        }
    ) {
        Text("Button")
    }
@dreson00 dreson00 added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Mar 31, 2024
@wangela
Copy link
Member

wangela commented Mar 31, 2024

If you would like to upvote the priority of this issue, please comment below or react on the original post above with 👍 so we can see what is popular when we triage.

@dreson00 Thank you for opening this issue. 🙏
Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

@CyberNut
Copy link

CyberNut commented Apr 2, 2024

Actual for me

@LukePavelka
Copy link

yes please.

@darronschall
Copy link

This might be by design? Per the documentation at https://developers.google.com/maps/documentation/android-sdk/infowindows#custom_info_windows the info window content is not designed to be interactive.

Note: The info window that is drawn is not a live view. The view is rendered as an image (using View.draw(Canvas)) at the time it is returned. This means that any subsequent changes to the view will not be reflected by the info window on the map. To update the info window later (for example, after an image has loaded), call showInfoWindow(). Furthermore, the info window will not respect any of the interactivity typical for a normal view such as touch or gesture events. However you can listen to a generic click event on the whole info window as described in the section below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

5 participants