Skip to content

feat(MarkerPreferences): allow custom interactive infowindow by providing HTMLElements to snippet #162

@DwieDima

Description

@DwieDima

Is your feature request related to a problem? Please describe.
Currently, the snippet attribute of a marker can only be used to specify a string, which is displayed above the markers (infowindow).
It is currently not possible to display complex infowindows with individual styling.
Furthermore, the Infowindow should allow interaction.

Does this feature exist in the Google Maps SDK for android and iOS? Please link the documentation for this feature.

  • for ios native i found that you can create a custom UIView
  • example for interactive ios InfoWindow.
  • Also for android there is some similar approach

Describe the solution you'd like

  • the snippet property of marker should accept string or HTMLElement
  • it should be possible to provide multiple items to snippet.
    • example: one marker represents a shopping store. Inside that shopping store there are multiple stores. By clicking that marker i would expect to see a list of these stores.
  • the infowindow should be scrollable.
  • the infowindow should adapt the width and height of provided HTMLElement.
  • there should be an event listener which emit on infowindow click.
    • this event listener should output the clicked HTMLElement id (for instance "apple-store"), so you know which of the items were clicked. For an example please see below.

Example HTMLElement

<div style="width: 200px; height: 500px; padding: 20px; border-radius: 10px">
   <div id="apple-store" style="margin: 5px 0px; height: 60px: text-align: center">Apple Store</div>
    <div id="primark" style="margin: 5px 0px; height: 60px: text-align: center">Primark</div>
    <div id="drugstore" style="margin: 5px 0px; height: 60px: text-align: center">Drugstore</div>
</div>

Example Event Listener

//click the first item in HTMLInfoWindow (apple-store)
CapacitorGoogleMaps.didTapSnippet((id) => { 
   // "apple-store"
  console.log(id)
} )

Additional context

Since we cannot use native elements like the links described above i think it should be possible to render a custom WebView inside the InfoWindow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions