How to use the @react-google-maps/infobox.InfoBox function in @react-google-maps/infobox

To help you get started, we’ve selected a few @react-google-maps/infobox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JustFly1984 / react-google-maps-api / packages / react-google-maps-api / src / components / addons / InfoBox.tsx View on Github external
componentDidMount() {
    const { options } = this.props
    const { position, ...infoBoxOptions }: InfoBoxOptions = options || {}

    let positionLatLng: google.maps.LatLng | undefined
    if (position && !(position instanceof google.maps.LatLng)) {
      positionLatLng = new google.maps.LatLng(position.lat, position.lng)
    }

    const infoBox = new GoogleMapsInfoBox({
      ...infoBoxOptions,
      ...(positionLatLng ? { position: positionLatLng } : {}),
    })

    this.containerElement = document.createElement('div')

    this.registeredEvents = applyUpdatersToPropsAndRegisterEvents({
      updaterMap,
      eventMap,
      prevProps: {},
      nextProps: this.props,
      instance: infoBox,
    })

    this.setState({ infoBox }, this.setInfoBoxCallback)
  }

@react-google-maps/infobox

InfoBox for React.js Google Maps API

MIT
Latest version published 26 days ago

Package Health Score

90 / 100
Full package analysis

Popular @react-google-maps/infobox functions