ordering-ui-react-native 0.16.27 → 0.16.30

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.16.27",
3
+ "version": "0.16.30",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -210,9 +210,22 @@ const AddressFormUI = (props: AddressFormParams) => {
210
210
  }
211
211
  if ( addressType === 'postal_code') {
212
212
  postalCode = component.short_name
213
+ if (isObjet) {
214
+ setValue('zipcode', postalCode)
215
+ handleChangeInput({ target: { name: 'zipcode', value: postalCode } })
216
+ }
213
217
  }
214
218
  }
215
219
  isObjet ? address = addressValue.join(', ') : address
220
+
221
+ if (isObjet) {
222
+ setValue('address', address)
223
+ handleChangeInput({ target: { name: 'address', value: address } })
224
+ googleInput?.current?.setAddressText(address)
225
+ setLoadingLocation(false)
226
+ return
227
+ }
228
+
216
229
  data.address = {
217
230
  address,
218
231
  location: json.results[0].geometry.location,
@@ -597,7 +610,7 @@ const AddressFormUI = (props: AddressFormParams) => {
597
610
  name='zipcode'
598
611
  rules={{ required: isRequiredField && isRequiredField('zipcode') ? t(`VALIDATION_ERROR_ZIP_CODE_REQUIRED`, `The field Zip Code is required`) : null }}
599
612
  defaultValue={address?.zipcode || formState.changes?.zipcode || addressState.address.zipcode || ''}
600
- render={() => (
613
+ render={({ value }) => (
601
614
  <OInput
602
615
  name='zipcode'
603
616
  placeholder={t('ZIP_CODE', 'Zip code')}
@@ -605,7 +618,7 @@ const AddressFormUI = (props: AddressFormParams) => {
605
618
  handleChangeInput(text)
606
619
  setValue('zipcode', text)
607
620
  }}
608
- value={address?.zipcode || formState.changes?.zipcode || addressState.address.zipcode || ''}
621
+ value={value || address?.zipcode || formState.changes?.zipcode || addressState.address.zipcode || ''}
609
622
  style={styles.inputsStyle}
610
623
  forwardRef={zipCodeRef}
611
624
  returnKeyType='next'
@@ -153,7 +153,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
153
153
  {(
154
154
  productInfo?.()?.ingredients?.length > 0 ||
155
155
  productInfo?.()?.options?.length > 0 ||
156
- product.comment
156
+ !!product.comment
157
157
  ) && !isClickableEvent && (
158
158
  <MaterialCommunityIcon name="chevron-down" size={12} />
159
159
  )}
@@ -278,7 +278,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
278
278
  </ProductOptionsList>
279
279
  )}
280
280
 
281
- {product.comment && (
281
+ {!!product.comment && (
282
282
  <ProductComment>
283
283
  <OText
284
284
  size={12}
@@ -55,6 +55,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
55
55
  } = props
56
56
 
57
57
  const screenHeight = Dimensions.get('window').height;
58
+ const screenWidth = Dimensions.get('window').width;
58
59
  const theme = useTheme()
59
60
  const [orderState] = useOrder()
60
61
  const { top } = useSafeAreaInsets();
@@ -339,7 +340,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
339
340
  handleCustomClick={() => onBusinessClick(business)}
340
341
  handleUpdateBusinessList={handleUpdateBusinessList}
341
342
  orderType={orderState?.options?.type}
342
- style={{ width: 320, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
343
+ style={{ width: screenWidth - 80, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
343
344
  />
344
345
  ))}
345
346
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
@@ -411,7 +412,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
411
412
  onProductClick={() => { }}
412
413
  productAddedToCartLength={0}
413
414
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
414
- style={{ width: 320, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
415
+ style={{ width: screenWidth - 80, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
415
416
  />
416
417
  )))}
417
418
 
@@ -7,11 +7,12 @@ import { ListWrapper } from './styles'
7
7
  import {
8
8
  View,
9
9
  StyleSheet,
10
- ScrollView
10
+ ScrollView,
11
+ Dimensions
11
12
  } from 'react-native';
12
13
  import { PreviousBusinessOrderedParams } from '../../../types';
13
14
 
14
- export const PreviousBusinessOrderedUI = (props : PreviousBusinessOrderedParams) => {
15
+ export const PreviousBusinessOrderedUI = (props: PreviousBusinessOrderedParams) => {
15
16
  const {
16
17
  navigation,
17
18
  businessesList,
@@ -23,6 +24,8 @@ export const PreviousBusinessOrderedUI = (props : PreviousBusinessOrderedParams)
23
24
  } = props
24
25
 
25
26
  const [orderState] = useOrder()
27
+ const windowWidth = Dimensions.get('window').width;
28
+
26
29
  const onBusinessClick = (business: any) => {
27
30
  onNavigationRedirect('Business', { store: business.slug })
28
31
  }
@@ -120,7 +123,7 @@ export const PreviousBusinessOrderedUI = (props : PreviousBusinessOrderedParams)
120
123
  <>
121
124
  {!businessLoading && (
122
125
  <BusinessControllerList
123
- style={{ width: 320, marginRight: 20 }}
126
+ style={{ width: windowWidth - 80, marginRight: 20 }}
124
127
  />
125
128
  )}
126
129
  </>
@@ -137,7 +140,7 @@ export const PreviousBusinessOrderedUI = (props : PreviousBusinessOrderedParams)
137
140
  )
138
141
  }
139
142
 
140
- export const PreviousBusinessOrdered = (props) => {
143
+ export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) => {
141
144
  const previousBusinessOrderedController = {
142
145
  ...props,
143
146
  UIComponent: PreviousBusinessOrderedUI,
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { ScrollView, StyleSheet } from 'react-native'
2
+ import { ScrollView, StyleSheet, Dimensions } from 'react-native'
3
3
  import {
4
4
  ListWrapper
5
5
  } from './styles'
@@ -7,13 +7,15 @@ import {
7
7
  import { SingleProductCard } from '../../SingleProductCard'
8
8
  import { PreviousProductsOrderedParams } from '../../../types'
9
9
 
10
- export const PreviousProductsOrdered = (props : PreviousProductsOrderedParams) => {
10
+ export const PreviousProductsOrdered = (props: PreviousProductsOrderedParams) => {
11
11
  const {
12
12
  products,
13
13
  onProductClick,
14
14
  isBusinessesSearchList
15
15
  } = props
16
16
 
17
+ const windowWidth = Dimensions.get('window').width;
18
+
17
19
  const styles = StyleSheet.create({
18
20
  container: {
19
21
  marginBottom: 0,
@@ -24,15 +26,15 @@ export const PreviousProductsOrdered = (props : PreviousProductsOrderedParams) =
24
26
  return (
25
27
  <>
26
28
  {products?.map((product: any) => (
27
- <SingleProductCard
28
- key={product?.id}
29
- isSoldOut={(product.inventoried && !product.quantity)}
30
- product={product}
31
- businessId={product?.business?.id}
32
- onProductClick={onProductClick}
33
- style={style}
34
- productAddedToCartLength={0}
35
- />
29
+ <SingleProductCard
30
+ key={product?.id}
31
+ isSoldOut={(product.inventoried && !product.quantity)}
32
+ product={product}
33
+ businessId={product?.business?.id}
34
+ onProductClick={onProductClick}
35
+ style={style}
36
+ productAddedToCartLength={0}
37
+ />
36
38
  ))}
37
39
  </>
38
40
  )
@@ -40,7 +42,7 @@ export const PreviousProductsOrdered = (props : PreviousProductsOrderedParams) =
40
42
  return (
41
43
  <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
42
44
  {isBusinessesSearchList ? (
43
- <ProductList style={{ width: 320, marginRight: 20 }} />
45
+ <ProductList style={{ width: windowWidth - 80, marginRight: 20 }} />
44
46
  ) : (
45
47
  <ListWrapper isBusinessesSearchList={isBusinessesSearchList}>
46
48
  <ProductList />