Center new work item on user
This commit is contained in:
@@ -6,6 +6,11 @@ import autobind from "autobind-decorator"
|
||||
export class Geolocation extends Component {
|
||||
static propTypes = {
|
||||
onUpdate: PropTypes.func.isRequired,
|
||||
watch: PropTypes.bool,
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
watch: true,
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
@@ -16,9 +21,12 @@ export class Geolocation extends Component {
|
||||
componentDidMount() {
|
||||
navigator.geolocation.getCurrentPosition((position) => {
|
||||
this.props.onUpdate(position)
|
||||
this.watchId = navigator.geolocation.watchPosition((position) =>
|
||||
this.props.onUpdate(position)
|
||||
)
|
||||
|
||||
if (this.props.watch) {
|
||||
this.watchId = navigator.geolocation.watchPosition((position) =>
|
||||
this.props.onUpdate(position)
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user