How to use the react-leaflet.PropTypes.latlng function in react-leaflet

To help you get started, we’ve selected a few react-leaflet 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 americanpanorama / panorama / src / Leaflet / Donut / Donut.jsx View on Github external
import React, {PropTypes, Children} from 'react';
import { Path, PropTypes as LeafletPropTypes } from 'react-leaflet';
import { DomEvent } from 'leaflet';
import { LeafletDonut } from './L.Donut';

export default class Donut extends Path {
  // Radii are in meters
  static propTypes = {
    center: LeafletPropTypes.latlng.isRequired,
    outerRadius: PropTypes.number.isRequired,
    innerRadius: PropTypes.number.isRequired,
  };

  static defaultProps = {};

  constructor() {
    super();
  }

  componentWillMount() {
    const {center, outerRadius, innerRadius, ...props} = this.props;
    super.componentWillMount();
    this.leafletElement = new LeafletDonut(center, outerRadius, innerRadius, this.getPathOptions(props));
  }
github americanpanorama / panorama / src / Leaflet / Tooltip / Tooltip.jsx View on Github external
import { PropTypes } from 'react';
import {Popup, PropTypes as LeafletPropTypes } from 'react-leaflet';
import { Map, popup } from 'leaflet';
import assign from 'lodash/object/assign';

export default class Tooltip extends Popup {
  static propTypes = {
    children: PropTypes.node,
    map: PropTypes.instanceOf(Map),
    tooltipContainer: PropTypes.object,
    position: LeafletPropTypes.latlng,
  };

  componentWillMount() {
    super.componentWillMount();

    const { children, map, ...props } = this.props;
    const options = assign({}, props);

    options.className = options.className ? options.className + ' panorama-leaflet-tip' : 'panorama-leaflet-tip';
    options.closeButton = false;
    options.offset = options.offset || [0, -3];

    this.leafletElement = popup(options);
  }

  componentDidMount() {}