Geolocation Module
The Geolocation module configures native location services, requests authorization, and reads the device’s current position.
import { Geolocation } from '@shopgate/native-modules';Example React component
Section titled “Example React component”import { useState } from 'react';import { Geolocation } from '@shopgate/native-modules';
export function LocateButton() { const [position, setPosition] = useState(null); const locate = async () => { await Geolocation.requestAuthorization(); setPosition(await Geolocation.getCurrentPosition()); }; return <button type="button" onClick={locate}>{position ? 'Located' : 'Locate me'}</button>;}setConfiguration(config)
Section titled “setConfiguration(config)”await Geolocation.setConfiguration({ authorizationLevel: 'whenInUse' });| Name | Type | Required | Description |
|---|---|---|---|
skipPermissionRequests |
boolean |
no | Prevent automatic permission requests. |
authorizationLevel |
string |
no | whenInUse, always, or auto. |
requestAuthorization()
Section titled “requestAuthorization()”await Geolocation.requestAuthorization();getCurrentPosition(params)
Section titled “getCurrentPosition(params)”const position = await Geolocation.getCurrentPosition({ enableHighAccuracy: true });getCurrentPosition() returns a native geolocation position with latitude, longitude, accuracy, and related coordinates.

