Fixing lint issues
This commit is contained in:
parent
5bed310153
commit
77b56e4169
2 changed files with 196 additions and 171 deletions
|
|
@ -1,27 +1,28 @@
|
|||
/* global Geolocation */
|
||||
import React from 'react';
|
||||
import './CenterInMyPosition.scss';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Tracker } from 'meteor/tracker';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Button } from 'react-bootstrap';
|
||||
import { translate } from 'react-i18next';
|
||||
import './CenterInMyPosition.scss';
|
||||
|
||||
class CenterInMyPosition extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
onClick = (event) => {
|
||||
onClick() {
|
||||
// this.props.onClick(event);
|
||||
// https://atmospherejs.com/mdg/geolocation
|
||||
// only with SSL:
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition
|
||||
|
||||
console.log('Center');
|
||||
// https://stackoverflow.com/questions/31608579/somethings-wrong-with-my-meteor-geolocation-functions
|
||||
var userGeoLocation = new ReactiveVar(null);
|
||||
var self = this;
|
||||
Tracker.autorun(function (computation) {
|
||||
const userGeoLocation = new ReactiveVar(null);
|
||||
const self = this;
|
||||
Tracker.autorun((computation) => {
|
||||
userGeoLocation.set(Geolocation.latLng());
|
||||
if (userGeoLocation.get()) {
|
||||
//stop the tracker if we got something
|
||||
var viewport = {
|
||||
// stop the tracker if we got something
|
||||
const viewport = {
|
||||
center: [userGeoLocation.get().lat, userGeoLocation.get().lng],
|
||||
zoom: 11
|
||||
};
|
||||
|
|
@ -35,11 +36,14 @@ class CenterInMyPosition extends React.Component {
|
|||
|
||||
render() {
|
||||
return (
|
||||
<Button bsStyle="default" onClick={(event) => this.onClick(event)}>
|
||||
<i className="icons icon-target"/>{this.props.t("Centrar el mapa en tu ubicación")}
|
||||
</Button>
|
||||
)
|
||||
<Button bsStyle="default" onClick={() => this.onClick()}>
|
||||
<i className="icons icon-target" />{this.props.t('Centrar el mapa en tu ubicación')}
|
||||
</Button>);
|
||||
}
|
||||
}
|
||||
|
||||
export default translate([], { wait: true }) (CenterInMyPosition);
|
||||
CenterInMyPosition.propTypes = {
|
||||
t: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default translate([], { wait: true })(CenterInMyPosition);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue