ordering-ui-react-native 0.24.5 → 0.24.6

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.24.5",
3
+ "version": "0.24.6",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -351,50 +351,50 @@ const AddressFormUI = (props: AddressFormParams) => {
351
351
  };
352
352
 
353
353
  const handleChangeAddress = (data: any, details: any) => {
354
- const addressObj : any = {}
355
- if (details?.address_components) {
356
- details.address_components.map((component: any) => {
357
- const addressType = component.types[0]
358
- if (addressType === 'postal_code') {
359
- addressObj.zipcode = component.short_name
360
- }
361
- if (addressType === 'street_number') {
362
- addressObj.street_number = component.long_name
363
- }
364
- if (addressType === 'neighborhood') {
365
- addressObj.neighborhood = component.long_name
366
- }
367
- if (addressType === 'route') {
368
- addressObj.route = component.short_name
369
- }
370
- if (addressType === 'locality') {
371
- addressObj.locality = component.long_name
372
- }
373
- if (component.types?.includes('sublocality')) {
374
- addressObj.sublocality = component.long_name
375
- }
376
- if (addressType === 'country') {
377
- addressObj.country = component.long_name
378
- addressObj.country_code = component.short_name
379
- }
380
- if (addressType === 'administrative_area_level_1') {
381
- addressObj.state = component.long_name
382
- }
383
- if (addressType === 'administrative_area_level_2') {
384
- addressObj.city = component.long_name
385
- }
386
- })
387
- }
388
- const addressSelected = {
389
- address: data?.description || data?.address,
390
- location: details?.geometry?.location,
391
- utc_offset: details?.utc_offset || null,
392
- map_data: { library: 'google', place_id: data.place_id },
393
- zipcode: data?.zipcode || null,
394
- ...addressObj
395
- };
396
- updateChanges(addressSelected);
397
- };
354
+ const addressObj: any = {}
355
+ if (details?.address_components) {
356
+ details.address_components.map((component: any) => {
357
+ const addressType = component.types[0]
358
+ if (addressType === 'postal_code') {
359
+ addressObj.zipcode = component.short_name
360
+ }
361
+ if (addressType === 'street_number') {
362
+ addressObj.street_number = component.long_name
363
+ }
364
+ if (addressType === 'neighborhood') {
365
+ addressObj.neighborhood = component.long_name
366
+ }
367
+ if (addressType === 'route') {
368
+ addressObj.route = component.short_name
369
+ }
370
+ if (addressType === 'locality') {
371
+ addressObj.locality = component.long_name
372
+ }
373
+ if (component.types?.includes('sublocality')) {
374
+ addressObj.sublocality = component.long_name
375
+ }
376
+ if (addressType === 'country') {
377
+ addressObj.country = component.long_name
378
+ addressObj.country_code = component.short_name
379
+ }
380
+ if (addressType === 'administrative_area_level_1') {
381
+ addressObj.state = component.long_name
382
+ }
383
+ if (addressType === 'administrative_area_level_2') {
384
+ addressObj.city = component.long_name
385
+ }
386
+ })
387
+ }
388
+ const addressSelected = {
389
+ address: data?.description || data?.address,
390
+ location: details?.geometry?.location,
391
+ utc_offset: details?.utc_offset || null,
392
+ map_data: { library: 'google', place_id: data.place_id },
393
+ zipcode: data?.zipcode || null,
394
+ ...addressObj
395
+ };
396
+ updateChanges(addressSelected);
397
+ };
398
398
 
399
399
  const handleAddressTag = (tag: string) => {
400
400
  setAddressTag(tag);
@@ -499,9 +499,9 @@ const AddressFormUI = (props: AddressFormParams) => {
499
499
  }, [formState]);
500
500
 
501
501
  useEffect(() => {
502
- if (formState?.result?.result && !formState?.loading) {
503
- if (formState.result?.error) {
504
- showToast(ToastType.Error, formState.result.result);
502
+ if (formState?.result && !formState?.loading) {
503
+ if (formState?.error) {
504
+ showToast(ToastType.Error, formState.error[0]);
505
505
  } else {
506
506
  showToast(
507
507
  ToastType.Success,