@hoddy-ui/core 1.0.14 → 1.0.15
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 +1 -1
- package/src/Components/Locator.tsx +12 -5
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ionicons } from "@expo/vector-icons";
|
|
2
|
-
import React, { useState } from "react";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
3
|
import { Alert, TouchableOpacity, View } from "react-native";
|
|
4
4
|
import { ListItem } from "./List";
|
|
5
5
|
import TextField from "./TextField";
|
|
@@ -16,16 +16,16 @@ import Typography from "./Typography";
|
|
|
16
16
|
const { GOOGLE_MAP_API_KEY } = getApiKey();
|
|
17
17
|
|
|
18
18
|
if (GOOGLE_MAP_API_KEY) Location.setGoogleApiKey(GOOGLE_MAP_API_KEY);
|
|
19
|
-
else
|
|
20
|
-
console.error(
|
|
21
|
-
"Google map api key needs to be set to use this component \nMake sure to run initialize() with a valid google map api key"
|
|
22
|
-
);
|
|
23
19
|
|
|
24
20
|
type predictionType = {
|
|
25
21
|
id: string;
|
|
26
22
|
description: string;
|
|
27
23
|
};
|
|
28
24
|
export const getPredictionsFromCoords = async (coords: any) => {
|
|
25
|
+
if (!GOOGLE_MAP_API_KEY)
|
|
26
|
+
console.error(
|
|
27
|
+
"Google map api key needs to be set to use this component \nMake sure to run initialize() with a valid google map api key"
|
|
28
|
+
);
|
|
29
29
|
if (!coords) return [];
|
|
30
30
|
const res = await (
|
|
31
31
|
await fetch(
|
|
@@ -150,6 +150,13 @@ export const Locator: React.FC<LocatorProps> = ({
|
|
|
150
150
|
setPrediction([]);
|
|
151
151
|
};
|
|
152
152
|
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
if (!GOOGLE_MAP_API_KEY)
|
|
155
|
+
console.error(
|
|
156
|
+
"Google map api key needs to be set to use this component \nMake sure to run initialize() with a valid google map api key"
|
|
157
|
+
);
|
|
158
|
+
}, [GOOGLE_MAP_API_KEY]);
|
|
159
|
+
|
|
153
160
|
return (
|
|
154
161
|
<View style={{ zIndex: 100 }}>
|
|
155
162
|
{renderInput ? (
|