@hoddy-ui/core 1.0.67 → 1.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hoddy-ui/core",
3
- "version": "1.0.67",
3
+ "version": "1.0.69",
4
4
  "description": "Core rich react native components written in typescript",
5
5
  "main": "index.ts",
6
6
  "repository": {
@@ -89,7 +89,7 @@ export const Locator: React.FC<LocatorProps> = ({
89
89
  },
90
90
  });
91
91
  const search = async (query: string) => {
92
- const endpoint = `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${query}&components=country:${country}&radius=20000&location=6.465422,3.406448&key=${GOOGLE_MAP_API_KEY}`;
92
+ const endpoint = `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${query}&components=country:${country}&radius=20000&key=${GOOGLE_MAP_API_KEY}`;
93
93
  const res = await (await fetch(endpoint)).json();
94
94
  const p = [];
95
95
  for (let key in res.predictions) {
@@ -145,11 +145,15 @@ export const Locator: React.FC<LocatorProps> = ({
145
145
  `https://maps.googleapis.com/maps/api/place/details/json?place_id=${loc.id}&fields=formatted_address%2Cgeometry&key=${GOOGLE_MAP_API_KEY}`
146
146
  )
147
147
  ).json();
148
- onLocationSelected({
149
- latitude: res.result?.geometry.location.lat,
150
- longitude: res.result?.geometry.location.lng,
151
- description: loc.description,
152
- });
148
+ onLocationSelected(
149
+ {
150
+ latitude: res.result?.geometry.location.lat,
151
+ longitude: res.result?.geometry.location.lng,
152
+
153
+ description: loc.description,
154
+ },
155
+ res.result?.formatted_address
156
+ );
153
157
  setChanged(false);
154
158
  setPrediction([]);
155
159
  };
package/src/types.ts CHANGED
@@ -154,7 +154,10 @@ export type LocatorInputProps = {
154
154
  };
155
155
  export interface LocatorProps {
156
156
  variant?: "contained" | "outlined";
157
- onLocationSelected: (location: locatorLocation | null) => void;
157
+ onLocationSelected: (
158
+ location: locatorLocation | null,
159
+ formatted_address?: string
160
+ ) => void;
158
161
  label?: string;
159
162
  error?: string;
160
163
  float?: boolean;