A LocateMe
component will be used to get the current pincode
of the user using google map api
.
A minimal Demo Link
Value | Used as a | Description |
---|---|---|
LocateMe | ✅ Component | Can be used as Component |
locateMe | ✅ Service | Can be used as Service |
// Default import will return LocateMe Component
import LocateMe from 'fe-pilot/LocateMe';
<LocateMe
googleKey="Require Google Map Key"
isProdKey={false}
/> // Used as a Component
import { LocateMe, locateMe } from 'fe-pilot/LocateMe';
<LocateMe
googleKey="Require Google Map Key"
isProdKey={false}
/> // Used as a Component
locateMe({
googleKey="Require Google Map Key"
isProdKey={false}
}); // Used as a Service
import { LocateMe } from 'fe-pilot/LocateMe';
const successCb = (response) => {
console.log("success response:", response);
}
const failureCb = (response) => {
console.log("failure response:", response);
}
return (
<LocateMe
successCb={successCb}
failureCb={failureCb}
googleKey="Require Google Map Key"
isProdKey={false}
>
Pass clickable element (button, anchor etc) here to bind onClick event
</LocateMe>
);
Props | Type | Description | Response |
---|---|---|---|
successCb | Function | It will be called on success |
{ data: "Can be array/object/string/number", msgType: "SUCCESSFUL", msg: "A success msg", status: "SUCCESS" } |
loadingCb | Function | It will be called before success/failure. |
{ msgType: "LOADING", msg: "LOADING...", status: "LOADING" } |
failureCb | Function | It will be called on failure |
{ msgType: "ERROR", msg: "A failed msg", status: "FAILURE" } |
Props | Type | Description | Default Values |
showForever | Boolean | To hide/remove unsupported feature, make it false. | Default value is true. |
googleKey(*) | String | Provide a googleKey for prod/lower-env | --- |
isProdKey(*) | Boolean | For non-production google key make it false | Default is true. |