Center new work item on user
This commit is contained in:
1 parent
23d4a95bd6
commit
15bc64a42b
3 files changed
+32
-4
No files matched your search
@@ -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