How to use the react-leaflet.MapControl 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 LiveBy / react-leaflet-control / dist / control.js View on Github external
// until this is called. We need to now force a render so that the
      // portal and children are actually rendered.
      this.forceUpdate();
    }
  }, {
    key: "render",
    value: function render() {
      if (!this.leafletElement || !this.leafletElement.getContainer()) {
        return null;
      }
      return _reactDom2.default.createPortal(this.props.children, this.leafletElement.getContainer());
    }
  }]);

  return LeafletControl;
}(_reactLeaflet.MapControl));
github opentripplanner / otp-react-redux / build / components / map / distance-measure.js View on Github external
unit: 'landmiles',
        measureControlLabel: '📏',
        backgroundColor: '#f3dd2d',
        clearMeasurementsOnStop: true
      });
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      var map = this.props.leaflet.map;
      this.leafletElement.addTo(map);
    }
  }]);

  return DistanceMeasure;
}(_reactLeaflet.MapControl);

var _default = (0, _reactLeaflet.withLeaflet)(DistanceMeasure);

exports.default = _default;
module.exports = exports.default;

//# sourceMappingURL=distance-measure.js
github tumerorkun / react-leaflet-search / lib / React-Leaflet-Search.js View on Github external
var _ = this;
        return this.state.search && this.props.showMarker ? _react2.default.createElement(
            _reactLeaflet.Marker,
            {
                ref: function ref(_ref) {
                    return _this4.markerRef = _ref;
                },
                icon: this.props.markerIcon || this.markerIcon,
                key: 'marker-search-' + this.state.search.toString(),
                position: [].concat(this.state.search) },
            this.props.showPopup && (this.props.popUp ? this.props.popUp(this.SearchInfo) : this.defaultPopUp())
        ) : null;
    };

    return ReactLeafletSearch;
}(_reactLeaflet.MapControl);

exports.default = ReactLeafletSearch;


ReactLeafletSearch.propTypes = {
    position: _propTypes2.default.string.isRequired,
    providerKey: _propTypes2.default.string,
    inputPlaceholder: _propTypes2.default.string,
    showMarker: _propTypes2.default.bool,
    showPopup: _propTypes2.default.bool,
    popUp: _propTypes2.default.func,
    zoom: _propTypes2.default.number,
    search: _propTypes2.default.arrayOf(_propTypes2.default.number),
    closeResultsOnClick: _propTypes2.default.bool,
    openSearchOnLoad: _propTypes2.default.bool,
    searchBounds: _propTypes2.default.array,