diff --git a/src/components/UserMap.js b/src/components/UserMap.js index 3f7e559b1b63f29a1f3840f0aae50234590db1de..31092dc717df87531e2e51152a41691ce28870cc 100644 --- a/src/components/UserMap.js +++ b/src/components/UserMap.js @@ -2,6 +2,22 @@ import React, { Component } from 'react'; import { Map, TileLayer, Marker, Popup } from 'react-leaflet'; class UserMap extends Component { + + getCurrentPosition(){ + if(!navigator.geolocation){ + console.log("Can't get geolocation :/"); + return null; + } + else{ + navigator.geolocation.getCurrentPosition((position)=>{ + return ({ + lat: position.coords.latitude, + lng: position.coords.longitude + }); + }); + } + } + render() { return ( <Map className='map' center={this.props.position} zoom={this.props.zoom}>