Closed gathrlabs closed 4 years ago
Never-mind, I worked it out.
You can just:
const geolocate = new mapboxgl.GeolocateControl();
map.addControl(geolocate, this.geolocateControl.position);
Make sure the controls have been loaded and then simply call:
geolocate.trigger();
Do that instead of adding as a prop to mapbox, ensuring that you have configured this.geolocateControl with all of the required options.
Thanks for your work on this package.
https://github.com/mapbox/mapbox-gl-js/issues/5464#issuecomment-426890317
How would I go about getting access to geoLocateControl and then using the trigger function which is apparently available?
https://docs.mapbox.com/mapbox-gl-js/api/#geolocatecontrol#trigger
Many thanks!