ordering-ui-react-native 0.18.61 → 0.18.62

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": "ordering-ui-react-native",
3
- "version": "0.18.61",
3
+ "version": "0.18.62",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -123,7 +123,7 @@ const AddressFormUI = (props: AddressFormParams) => {
123
123
  },
124
124
  wrapperNavbar: Platform.OS === 'ios'
125
125
  ? { paddingVertical: 0, paddingLeft: 40, paddingRight: 20 }
126
- : { paddingVertical: 20, paddingLeft: 40, paddingRight: 20 }
126
+ : { paddingVertical: 10, paddingLeft: 40, paddingRight: 20 }
127
127
  });
128
128
 
129
129
  const [, t] = useLanguage();
@@ -176,7 +176,6 @@ const AddressFormUI = (props: AddressFormParams) => {
176
176
 
177
177
  const getAddressFormatted = (address: any) => {
178
178
  const data: any = { address: null, error: null };
179
- Geocoder.init(googleMapsApiKey);
180
179
  Geocoder.from(address)
181
180
  .then((json) => {
182
181
  if (json.results && json.results?.length > 0) {
@@ -491,6 +490,10 @@ const AddressFormUI = (props: AddressFormParams) => {
491
490
  }
492
491
  }, []);
493
492
 
493
+ useEffect(() => {
494
+ Geocoder.init(googleMapsApiKey);
495
+ }, [googleMapsApiKey]);
496
+
494
497
  useEffect(() => {
495
498
  const keyboardDidShowListener = Keyboard.addListener(
496
499
  'keyboardDidShow',
@@ -535,7 +538,7 @@ const AddressFormUI = (props: AddressFormParams) => {
535
538
  />
536
539
  </View>
537
540
  <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
538
- <AddressFormContainer style={{ height: HEIGHT_SCREEN * .78, overflow: 'scroll' }}>
541
+ <AddressFormContainer style={{ overflow: 'scroll' }}>
539
542
  <View>
540
543
  <FormInput>
541
544
  <AutocompleteInput>
@@ -640,6 +643,7 @@ const AddressFormUI = (props: AddressFormParams) => {
640
643
  }
641
644
  }}
642
645
  IconButton={<OIcon src={theme.images.general.pin} width={16} />}
646
+ isIntGeoCoder
643
647
  />
644
648
  </View>
645
649
  )}
@@ -661,6 +665,7 @@ const AddressFormUI = (props: AddressFormParams) => {
661
665
  saveLocation={saveMapLocation}
662
666
  setSaveLocation={setSaveMapLocation}
663
667
  handleToggleMap={handleToggleMap}
668
+ isIntGeoCoder
664
669
  />
665
670
  </GoogleMapContainer>
666
671
  </View>
@@ -871,6 +876,7 @@ const AddressFormUI = (props: AddressFormParams) => {
871
876
  saveLocation={saveMapLocation}
872
877
  setSaveLocation={setSaveMapLocation}
873
878
  handleToggleMap={handleToggleMap}
879
+ isIntGeoCoder
874
880
  />
875
881
  </GoogleMapContainer>
876
882
  )}
@@ -12,7 +12,8 @@ export const GPSButton = (props: any) => {
12
12
  handleGPS,
13
13
  apiKey,
14
14
  IconButton,
15
- IconLoadingButton
15
+ IconLoadingButton,
16
+ isIntGeoCoder
16
17
  } = props
17
18
 
18
19
  const [isLoading, setLoading] = useState(false);
@@ -31,7 +32,7 @@ export const GPSButton = (props: any) => {
31
32
  break
32
33
  }
33
34
  }
34
- let data = null
35
+ let data : any
35
36
  const details = {
36
37
  geometry: { location: { lat: pos.latitude, lng: pos.longitude } }
37
38
  }
@@ -68,12 +69,13 @@ export const GPSButton = (props: any) => {
68
69
  setLoading(false);
69
70
  console.log(`ERROR(${err.code}): ${err.message}`)
70
71
  }, {
71
- enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
72
+ enableHighAccuracy: false, timeout: 30000, maximumAge: 1000
72
73
  })
73
74
  }
74
75
  }
75
76
 
76
77
  useEffect(() => {
78
+ if (isIntGeoCoder) return
77
79
  Geocoder.init(apiKey);
78
80
  }, [])
79
81
 
@@ -18,7 +18,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
18
18
  saveLocation,
19
19
  setSaveLocation,
20
20
  handleToggleMap,
21
- locations
21
+ locations,
22
+ isIntGeoCoder
22
23
  } = props
23
24
 
24
25
  const [, t] = useLanguage()
@@ -161,8 +162,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
161
162
  }
162
163
 
163
164
  useEffect(() => {
165
+ if (isIntGeoCoder) return
164
166
  Geocoder.init(googleMapsApiKey)
165
- }, [])
167
+ }, [isIntGeoCoder])
166
168
 
167
169
  useEffect(() => {
168
170
  mapRef.current.animateToRegion({
@@ -629,7 +629,8 @@ export interface GoogleMapsParams {
629
629
  isSetInputs?: boolean,
630
630
  locations?: Array<any>,
631
631
  setSaveLocation?: (val: boolean) => void,
632
- handleToggleMap?: () => void
632
+ handleToggleMap?: () => void,
633
+ isIntGeoCoder: boolean
633
634
  }
634
635
 
635
636
  export interface HelpParams {