ordering-ui-react-native 0.21.21 → 0.21.22

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.21.21",
3
+ "version": "0.21.22",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,8 +1,8 @@
1
1
  import React, { useEffect } from 'react'
2
- import { AddressList as AddressListController, useLanguage, useOrder, useSession } from 'ordering-components/native'
2
+ import { AddressList as AddressListController, useLanguage, useOrder } from 'ordering-components/native'
3
3
  import { AddressItem, Container } from './styles'
4
4
  import { Platform, RefreshControl, StyleSheet, View } from 'react-native'
5
- import { OButton, OText, OAlert, OModal, OIcon } from '../shared'
5
+ import { OButton, OText, OAlert, OIcon } from '../shared'
6
6
  import { AddressListParams } from '../../types'
7
7
  import { NotFoundSource } from '../NotFoundSource'
8
8
  import NavBar from '../NavBar'
@@ -18,12 +18,10 @@ const AddressListUI = (props: AddressListParams) => {
18
18
  route,
19
19
  addressList,
20
20
  isFromProfile,
21
- nopadding,
22
21
  handleSetDefault,
23
22
  handleDelete,
24
23
  setAddressList,
25
24
  isGoBack,
26
- actionStatus,
27
25
  isFromBusinesses,
28
26
  isFromProductsList,
29
27
  afterSignup,
@@ -34,7 +32,6 @@ const AddressListUI = (props: AddressListParams) => {
34
32
 
35
33
  const [orderState] = useOrder()
36
34
  const [, t] = useLanguage()
37
- const [{ auth }] = useSession()
38
35
  const [refreshing] = useState(false);
39
36
 
40
37
  const [isProfile, setIsProfile] = useState(isFromProfile || route?.params?.isFromProfile);
@@ -296,8 +293,8 @@ const AddressListUI = (props: AddressListParams) => {
296
293
  <OButton
297
294
  text={t('ADD_NEW_ADDRESS', 'Add new Address')}
298
295
  imgRightSrc=''
299
- bgColor={theme.colors.white}
300
- textStyle={{ color: theme.colors.primary }}
296
+ bgColor={theme.colors.primary}
297
+ textStyle={{ color: theme.colors.white }}
301
298
  style={styles.button}
302
299
  borderColor={theme.colors.primary}
303
300
  onClick={() => !afterSignup ? onNavigationRedirect(
@@ -217,7 +217,7 @@ export const BusinessBasicInformation = (
217
217
  <Placeholder Animation={Fade}>
218
218
  <View style={{ flexDirection: 'row' }}>
219
219
  {[...Array(5).keys()].map(i => (
220
- <View style={styles.socialIcon} key={i}>
220
+ <View style={{ ...styles.socialIcon, borderWidth: 0 }} key={i}>
221
221
  <PlaceholderLine width={100} height={20} style={{ marginBottom: 0 }} />
222
222
  </View>
223
223
  ))}
@@ -270,10 +270,10 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
270
270
  </BusinessLogo>
271
271
  )}
272
272
  </BusinessInfo>
273
- <View style={{ width: '100%', flexDirection: 'row', justifyContent: 'space-between', marginTop: 5 }}>
273
+ <View style={{ width: '100%', flexDirection: 'row', justifyContent: 'space-between', marginTop: 5, alignItems: 'flex-start' }}>
274
274
  <OText
275
275
  size={textSize + 2}
276
- style={{ lineHeight: 18, marginBottom: 6 }}
276
+ style={{ lineHeight: 18, marginBottom: 6, width: '90%' }}
277
277
  weight={'500'}>
278
278
  {business?.name}
279
279
  </OText>
@@ -351,9 +351,15 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
351
351
  onClick={() => onBusinessClick(business)}
352
352
  textStyle={{ color: theme.colors.primary, fontSize: 10 }}
353
353
  text={t('GO_TO_STORE', 'Go to store')}
354
- bgColor='#F5F9FF'
355
- borderColor='#fff'
356
- style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
354
+ style={{
355
+ borderRadius: 23,
356
+ paddingLeft: 10,
357
+ paddingRight: 10,
358
+ height: 23,
359
+ shadowOpacity: 0,
360
+ backgroundColor: theme.colors.primaryContrast,
361
+ borderWidth: 0
362
+ }}
357
363
  />
358
364
  </SingleBusinessContainer>
359
365
  <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
@@ -143,10 +143,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
143
143
 
144
144
  const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
145
145
  const isQuickAddProduct = configs?.add_product_with_one_click?.value === '1'
146
- const openCarts = (Object.values(orderState?.carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && !cart?.wallets) || null) || []
147
146
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
148
147
  const isOpenFiltProducts = isOpenSearchBar && !!searchValue
149
- const filtProductsHeight = Platform.OS === 'ios' ? 165 : 100
150
148
  const viewOrderButtonVisible = !loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0
151
149
 
152
150
  const onRedirect = (route: string, params?: any) => {
@@ -475,8 +473,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
475
473
  {business?.categories?.length > 0 && isOpenFiltProducts && (
476
474
  <FiltProductsContainer
477
475
  style={{
478
- height: Dimensions.get('window').height - filtProductsHeight - keyboardHeight - (keyboardHeight > 0 && viewOrderButtonVisible ? 55 : 0),
479
- top: Platform.OS === 'ios' ? (searchBarHeight - 10) + insets.top : searchBarHeight,
476
+ height: Dimensions.get('window').height - (keyboardHeight + (Platform.OS === 'ios' ? 100 : 80)),
477
+ top: Platform.OS === 'ios' ? searchBarHeight + insets.top : searchBarHeight
480
478
  }}
481
479
  contentContainerStyle={{ flexGrow: 1 }}
482
480
  >
@@ -515,7 +513,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
515
513
  </FiltProductsContainer>
516
514
  )}
517
515
  {isOpenFiltProducts && (
518
- <BackgroundGray isIos={Platform.OS === 'ios'} />
516
+ <BackgroundGray isIos={Platform.OS === 'ios'} style={{ marginTop: insets.top + 60 }} />
519
517
  )}
520
518
  <IOScrollView
521
519
  stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 3]}
@@ -42,10 +42,9 @@ export const FiltProductsContainer = styled.ScrollView`
42
42
 
43
43
  export const BackgroundGray = styled.View`
44
44
  flex: 1;
45
- height: ${(props: any) => props.isIos ? '80%' : '100%'};
45
+ height: 100%;
46
46
  background-color: rgba(0,0,0,0.5);
47
47
  position: absolute;
48
- margin-top: 100px;
49
48
  z-index: 10000;
50
49
  width: 100%;
51
50
  `
@@ -126,9 +126,13 @@ const MessagesUI = (props: MessagesParams) => {
126
126
  const messageConsole = (message: any) => {
127
127
  return message.change?.attribute !== 'driver_id'
128
128
  ?
129
- `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute) ?
130
- `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
131
- `${message.change?.attribute !== 'logistic_status' ? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)]) : message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status' ? t(ORDER_STATUS[parseInt(message.change.new, 10)]) : getLogisticTag(message.change.new)}`
129
+ `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
130
+ ? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
131
+ : `${message.change?.attribute !== 'logistic_status'
132
+ ? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
133
+ : message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
134
+ ? t(ORDER_STATUS[parseInt(message.change.new, 10)])
135
+ : getLogisticTag(message.change.new)}`
132
136
  }`
133
137
  : message.change.new
134
138
  ?
@@ -77,6 +77,7 @@ const PageBannerUI = (props: any) => {
77
77
  const renderItem = ({ item, index }) => {
78
78
  return (
79
79
  <TouchableOpacity
80
+ activeOpacity={1}
80
81
  onPress={() => handleGoToPage(item)}
81
82
  >
82
83
  <View style={styles.sliderWrapper}>
@@ -128,6 +129,7 @@ const PageBannerUI = (props: any) => {
128
129
  {pageBannerState.banner?.items.length > 1 && (
129
130
  <>
130
131
  <TouchableOpacity
132
+ activeOpacity={1}
131
133
  style={[styles.swiperButton, { left: 25 }]}
132
134
  onPress={() => carouselRef.current.snapToPrev()}
133
135
  >
@@ -138,6 +140,7 @@ const PageBannerUI = (props: any) => {
138
140
  />
139
141
  </TouchableOpacity>
140
142
  <TouchableOpacity
143
+ activeOpacity={1}
141
144
  style={[styles.swiperButton, { right: 25 }]}
142
145
  onPress={() => carouselRef.current.snapToNext()}
143
146
  >
@@ -137,7 +137,9 @@ export const ProductOptionsUI = (props: any) => {
137
137
  },
138
138
  slide1: {
139
139
  flex: 1,
140
- alignItems: 'center'
140
+ alignItems: 'center',
141
+ width: '100%',
142
+ marginLeft: 32
141
143
  },
142
144
  mainSwiper: {
143
145
  height: 258,
@@ -371,12 +373,8 @@ export const ProductOptionsUI = (props: any) => {
371
373
  </>
372
374
  );
373
375
 
374
- const handleScroll = ({ nativeEvent: { contentOffset, layoutMeasurement } }: any) => {
376
+ const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
375
377
  setShowTitle(contentOffset.y > 30)
376
- const _topOption = Object.keys(optionLayout).find(((option: any) => Math.abs(contentOffset?.y - layoutMeasurement?.height - optionLayout[option]?.y) < 20))
377
- if (_topOption) {
378
- const _topOptionId = Number(_topOption.replace('id:', ''))
379
- }
380
378
  }
381
379
 
382
380
  const handleGoBack = navigation?.canGoBack()
@@ -563,6 +561,7 @@ export const ProductOptionsUI = (props: any) => {
563
561
  ref={scrollViewRef}
564
562
  contentContainerStyle={{ paddingBottom: 80 }}
565
563
  stickyHeaderIndices={[2]}
564
+ scrollEventThrottle={100}
566
565
  onScroll={handleScroll}
567
566
  >
568
567
  <WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
@@ -760,6 +759,7 @@ export const ProductOptionsUI = (props: any) => {
760
759
  </ProductDescription>
761
760
  <ScrollView
762
761
  horizontal
762
+ scrollEventThrottle={100}
763
763
  showsHorizontalScrollIndicator={false}
764
764
  contentContainerStyle={{ paddingBottom: 30 }}
765
765
  >
@@ -787,6 +787,7 @@ export const ProductOptionsUI = (props: any) => {
787
787
  {(!loading && product) && (
788
788
  <ExtraOptionWrap
789
789
  horizontal
790
+ scrollEventThrottle={100}
790
791
  showsHorizontalScrollIndicator={false}
791
792
  style={{
792
793
  marginBottom: 20,
@@ -913,12 +914,7 @@ export const ProductOptionsUI = (props: any) => {
913
914
  }}>
914
915
  {option?.suboptions?.sort((a: any, b: any) => a.rank - b.rank).map(
915
916
  (suboption: any) => {
916
- const currentState =
917
- productCart.options[
918
- `id:${option.id}`
919
- ]?.suboptions[
920
- `id:${suboption.id}`
921
- ] || {};
917
+ const currentState = productCart.options[`id:${option.id}`]?.suboptions[`id:${suboption.id}`] || {};
922
918
  const balance =
923
919
  productCart.options[
924
920
  `id:${option.id}`
@@ -933,6 +929,7 @@ export const ProductOptionsUI = (props: any) => {
933
929
  balance={balance}
934
930
  option={option}
935
931
  suboption={suboption}
932
+ image={option.image}
936
933
  state={currentState}
937
934
  disabled={
938
935
  isSoldOut ||
@@ -7,6 +7,7 @@ import {
7
7
  import { useTheme } from 'styled-components/native';
8
8
  import { StyleSheet, View } from 'react-native'
9
9
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
10
+ import FastImage from 'react-native-fast-image';
10
11
 
11
12
  import {
12
13
  Container,
@@ -14,7 +15,8 @@ import {
14
15
  QuantityControl,
15
16
  Checkbox,
16
17
  PositionControl,
17
- Circle
18
+ Circle,
19
+ Logo
18
20
  } from './styles'
19
21
  import { OIcon, OText } from '../shared'
20
22
 
@@ -29,7 +31,8 @@ export const ProductOptionSubOptionUI = (props: any) => {
29
31
  toggleSelect,
30
32
  changePosition,
31
33
  disabled,
32
- setIsScrollAvailable
34
+ setIsScrollAvailable,
35
+ image
33
36
  } = props
34
37
 
35
38
  const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max || state.quantity === suboption?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
@@ -37,12 +40,24 @@ export const ProductOptionSubOptionUI = (props: any) => {
37
40
 
38
41
  const theme = useTheme();
39
42
  const [, t] = useLanguage()
40
- const [{ parsePrice }] = useUtils()
43
+ const [{ parsePrice, optimizeImage }] = useUtils()
41
44
  const [showMessage, setShowMessage] = useState(false)
42
45
  const [isDirty, setIsDirty] = useState(false)
43
46
 
44
47
  const iconsSize = 20
45
48
 
49
+ const styles = StyleSheet.create({
50
+ icon: {
51
+ borderRadius: 7.6,
52
+ width: 60,
53
+ height: 60
54
+ },
55
+ logo: {
56
+ borderRadius: 10,
57
+ marginLeft: 3,
58
+ },
59
+ });
60
+
46
61
  const handleSuboptionClick = () => {
47
62
  toggleSelect()
48
63
  setIsDirty(true)
@@ -82,6 +97,18 @@ export const ProductOptionSubOptionUI = (props: any) => {
82
97
  <OIcon src={theme.images.general.radio_nor} color={theme.colors.disabled} width={16} />
83
98
  )
84
99
  )}
100
+ {image && (
101
+ <Logo style={styles.logo}>
102
+ <FastImage
103
+ style={styles.icon}
104
+ source={{
105
+ uri: optimizeImage(image, 'h_100,c_limit'),
106
+ priority: FastImage.priority.normal,
107
+ }}
108
+ resizeMode={FastImage.resizeMode.cover}
109
+ />
110
+ </Logo>
111
+ )}
85
112
  <OText size={12} lineHeight={18} color={theme.colors.textSecondary} mLeft={5} style={{ flex: 1 }}>
86
113
  {suboption?.name}
87
114
  </OText>
@@ -141,7 +168,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
141
168
  </PositionControl>
142
169
  )}
143
170
  {price > 0 && (
144
- <OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{width: 70, maxWidth: 70}}>
171
+ <OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{ width: 70, maxWidth: 70 }}>
145
172
  + {parsePrice(price)}
146
173
  </OText>
147
174
  )}
@@ -10,7 +10,7 @@ export const Container = styled.TouchableOpacity`
10
10
  export const IconControl = styled.TouchableOpacity`
11
11
  flex-direction: row;
12
12
  padding: 10px 0 10px 10px;
13
- width: 35%;
13
+ width: 50%;
14
14
  align-items: center;
15
15
  `
16
16
 
@@ -32,3 +32,8 @@ export const Checkbox = styled.TouchableOpacity`
32
32
  export const Circle = styled.TouchableOpacity`
33
33
  margin: 0 1.5px;
34
34
  `
35
+
36
+ export const Logo = styled.View`
37
+ height: 65px;
38
+ width: 65px;
39
+ `;
@@ -448,8 +448,8 @@ export const UserFormDetailsUI = (props: any) => {
448
448
  ? t('UPDATING', 'Updating...')
449
449
  : t('UPDATE', 'Update')
450
450
  }
451
- bgColor={theme.colors.white}
452
- textStyle={{ color: theme.colors.primary, fontSize: 14 }}
451
+ bgColor={theme.colors.primary}
452
+ textStyle={{ color: theme.colors.white, fontSize: 14 }}
453
453
  borderColor={theme.colors.primary}
454
454
  isDisabled={formState.loading}
455
455
  imgRightSrc={null}
@@ -288,43 +288,37 @@ const ProfileUI = (props: ProfileParams) => {
288
288
  showCall={false}
289
289
  btnStyle={{ paddingLeft: 0 }}
290
290
  />
291
- <KeyboardAvoidingView
292
- behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
293
- enabled={Platform.OS === 'ios' ? true : false}
294
- style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}
295
- >
296
- <CenterView>
297
- <View style={styles.photo}>
298
- {user?.photo ? (
299
- <FastImage
300
- style={{ height: 80, width: 80, borderRadius: 8 }}
301
- source={{
302
- uri: user?.photo,
303
- priority: FastImage.priority.normal,
304
- }}
305
- resizeMode={FastImage.resizeMode.cover}
306
- />
307
- ) : (
308
- <Ionicons name='person-outline' size={50} />
309
- )}
310
- </View>
311
- <OIconButton
312
- icon={theme.images.general.camera}
313
- borderColor={theme.colors.clear}
314
- iconStyle={{ width: 20, height: 20 }}
315
- style={{ maxWidth: 40, position: 'absolute', alignSelf: 'center', backgroundColor: '#000', opacity: 0.5 }}
316
- onClick={() => handleImagePicker()}
317
- />
318
- </CenterView>
319
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginVertical: 32, zIndex: 10 }} />
320
- <Spinner visible={formState?.loading || verifyPhoneState?.loading} />
321
- <UserFormDetailsUI
322
- {...props}
323
- isProfile
324
- isEdit
325
- setWillVerifyOtpState={setWillVerifyOtpState}
291
+ <CenterView>
292
+ <View style={styles.photo}>
293
+ {user?.photo ? (
294
+ <FastImage
295
+ style={{ height: 80, width: 80, borderRadius: 8 }}
296
+ source={{
297
+ uri: user?.photo,
298
+ priority: FastImage.priority.normal,
299
+ }}
300
+ resizeMode={FastImage.resizeMode.cover}
301
+ />
302
+ ) : (
303
+ <Ionicons name='person-outline' size={50} />
304
+ )}
305
+ </View>
306
+ <OIconButton
307
+ icon={theme.images.general.camera}
308
+ borderColor={theme.colors.clear}
309
+ iconStyle={{ width: 20, height: 20 }}
310
+ style={{ maxWidth: 40, position: 'absolute', alignSelf: 'center', backgroundColor: '#000', opacity: 0.5 }}
311
+ onClick={() => handleImagePicker()}
326
312
  />
327
- </KeyboardAvoidingView>
313
+ </CenterView>
314
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginVertical: 32, zIndex: 10 }} />
315
+ <Spinner visible={formState?.loading || verifyPhoneState?.loading} />
316
+ <UserFormDetailsUI
317
+ {...props}
318
+ isProfile
319
+ isEdit
320
+ setWillVerifyOtpState={setWillVerifyOtpState}
321
+ />
328
322
  </Container>
329
323
  <OModal
330
324
  open={isModalVisible}
@@ -73,7 +73,7 @@ const WalletsUI = (props: any) => {
73
73
  const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
74
74
  const [openHistory, setOpenHistory] = useState(false)
75
75
  const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
76
- const hideWalletsTheme = theme?.bar_menu?.components?.wallets?.hidden
76
+ const hideWalletsTheme = theme?.bar_menu?.components?.wallet?.hidden === true
77
77
 
78
78
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
79
79
 
@@ -128,10 +128,10 @@ const WalletsUI = (props: any) => {
128
128
  ...{
129
129
  width: '100%',
130
130
  display: 'flex',
131
- flexDirection: hideWalletsTheme ? 'column' : 'row',
132
- justifyContent: hideWalletsTheme ? 'flex-start' : 'space-between',
133
- alignItems: hideWalletsTheme ? 'flex-start' : 'center',
134
- marginTop: hideWalletsTheme ? 0 : 10,
131
+ flexDirection: !hideWalletsTheme ? 'column' : 'row',
132
+ justifyContent: !hideWalletsTheme ? 'flex-start' : 'space-between',
133
+ alignItems: !hideWalletsTheme ? 'flex-start' : 'center',
134
+ marginTop: !hideWalletsTheme ? 0 : 10,
135
135
  },
136
136
  }}>
137
137
  <NavBar
@@ -151,7 +151,7 @@ const WalletsUI = (props: any) => {
151
151
  imgRightSrc={null}
152
152
  textStyle={{ fontSize: 12, color: theme.colors.disabled }}
153
153
  onClick={() => setOpenHistory(true)}
154
- style={{ borderRadius: 8, height: 40, width: hideWalletsTheme ? '100%' : 150, marginTop: hideWalletsTheme ? 10 : 0 }}
154
+ style={{ borderRadius: 8, height: 40, width: !hideWalletsTheme ? '100%' : 150, marginTop: !hideWalletsTheme ? 10 : 0 }}
155
155
  />
156
156
  )}
157
157
  </View>