ordering-ui-react-native 0.16.18 → 0.16.19

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.18",
3
+ "version": "0.16.19",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -31,7 +31,8 @@ import {
31
31
  ListWrapper,
32
32
  FeaturedWrapper,
33
33
  OrderProgressWrapper,
34
- FarAwayMessage
34
+ FarAwayMessage,
35
+ AddressInputContainer
35
36
  } from './styles';
36
37
 
37
38
  import { SearchBar } from '../SearchBar';
@@ -84,7 +85,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
84
85
  wrapperOrderOptions: {
85
86
  width: '100%',
86
87
  flexDirection: 'row',
87
- justifyContent: 'space-between',
88
+ justifyContent: 'center',
88
89
  marginBottom: 10,
89
90
  zIndex: 100,
90
91
  },
@@ -94,7 +95,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
94
95
  borderRadius: 10,
95
96
  },
96
97
  searchInput: {
97
- fontSize: 12,
98
+ fontSize: 16,
99
+ backgroundColor: theme.colors.white,
100
+ paddingLeft: 10,
101
+ paddingTop: 7
98
102
  },
99
103
  iconStyle: {
100
104
  fontSize: 18,
@@ -104,6 +108,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
104
108
  farAwayMsg: {
105
109
  paddingVertical: 6,
106
110
  paddingHorizontal: 20
111
+ },
112
+ inputContainerStyles: {
113
+ backgroundColor: theme.colors.white,
114
+ borderColor: theme.colors.backgroundGray,
115
+ borderWidth: 1,
107
116
  }
108
117
  });
109
118
 
@@ -124,7 +133,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
124
133
  Number(configs?.max_days_preorder?.value) > 0
125
134
  const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
126
135
  const timerId = useRef<any>(false)
127
- const [favoriteIds, setFavoriteIds] = useState<any>([])
136
+ const [favoriteIds, setFavoriteIds] = useState<any>([])
128
137
 
129
138
  // const panResponder = useRef(
130
139
  // PanResponder.create({
@@ -219,7 +228,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
219
228
  }, [orderState?.options?.address?.location])
220
229
 
221
230
  useEffect(() => {
222
- if(!orderState?.loading){
231
+ if (!orderState?.loading) {
223
232
  setOrderTypeValue(orderState?.options?.type)
224
233
  }
225
234
  }, [orderState?.options?.type])
@@ -232,15 +241,15 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
232
241
  )
233
242
 
234
243
  useEffect(() => {
235
- if (!businessesList?.businesses?.length) return
236
- const ids = [...favoriteIds]
237
- businessesList.businesses.forEach((business: any) => {
238
- if (business?.favorite) {
239
- ids.push(business?.id)
240
- }
241
- })
242
- setFavoriteIds([...new Set(ids)])
243
- }, [businessesList?.businesses?.length])
244
+ if (!businessesList?.businesses?.length) return
245
+ const ids = [...favoriteIds]
246
+ businessesList.businesses.forEach((business: any) => {
247
+ if (business?.favorite) {
248
+ ids.push(business?.id)
249
+ }
250
+ })
251
+ setFavoriteIds([...new Set(ids)])
252
+ }, [businessesList?.businesses?.length])
244
253
 
245
254
  return (
246
255
  <ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
@@ -251,15 +260,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
251
260
  />
252
261
  }
253
262
  >
254
- <HeaderWrapper
255
- source={theme.images.backgrounds.business_list_header}
256
- style={{ paddingTop: top + 20 }}>
257
- {!auth && (
258
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
259
- <OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
260
- </TouchableOpacity>
261
- )}
262
-
263
+ <View style={{ height: isFarAway ? 150 : 100, marginTop: Platform.OS == 'ios' ? 0 : 50 }}>
263
264
  <Search>
264
265
  <AddressInput
265
266
  onPress={() =>
@@ -271,15 +272,22 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
271
272
  isGuestUser: isGuestUser
272
273
  })
273
274
  }>
274
- <OIcon
275
- src={theme.images.general.pin}
276
- color={theme.colors.disabled}
277
- width={16}
278
- style={{ marginRight: 10 }}
279
- />
280
- <OText size={12} numberOfLines={1} style={{ width: '90%' }}>
281
- {orderState?.options?.address?.address}
282
- </OText>
275
+ <AddressInputContainer>
276
+ <OIcon
277
+ src={theme.images.general.pin}
278
+ color={theme.colors.disabled}
279
+ width={16}
280
+ style={{ marginRight: 10 }}
281
+ />
282
+ <OText size={12} numberOfLines={1}>
283
+ {orderState?.options?.address?.address}
284
+ </OText>
285
+ <OIcon
286
+ src={theme.images.general.arrow_down}
287
+ width={10}
288
+ style={{ marginStart: 8 }}
289
+ />
290
+ </AddressInputContainer>
283
291
  </AddressInput>
284
292
  </Search>
285
293
  {isFarAway && (
@@ -288,16 +296,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
288
296
  <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
289
297
  </FarAwayMessage>
290
298
  )}
299
+
291
300
  <OrderControlContainer>
292
301
  <View style={styles.wrapperOrderOptions}>
293
- <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
294
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
295
- <OIcon
296
- src={theme.images.general.arrow_down}
297
- width={10}
298
- style={{ marginStart: 8 }}
299
- />
300
- </WrapMomentOption>
301
302
  {isPreOrderSetting && (
302
303
  <WrapMomentOption
303
304
  onPress={() => handleMomentClick()}>
@@ -319,27 +320,48 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
319
320
  )}
320
321
  </WrapMomentOption>
321
322
  )}
322
-
323
- {!businessId && (
324
- <SearchBar
325
- onSearch={handleChangeSearch}
326
- searchValue={searchValue}
327
- lazyLoad
328
- isCancelXButtonShow={!!searchValue}
329
- borderStyle={styles.borderStyle}
330
- onCancel={() => handleChangeSearch('')}
331
- placeholder={t('SEARCH', 'Search')}
332
- height={26}
333
- isDisabled={!businessTypes}
334
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
335
- onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
323
+ <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
324
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
325
+ <OIcon
326
+ src={theme.images.general.arrow_down}
327
+ width={10}
328
+ style={{ marginStart: 8 }}
336
329
  />
337
- )}
338
-
330
+ </WrapMomentOption>
339
331
  </View>
340
332
  </OrderControlContainer>
333
+ </View>
334
+ <HeaderWrapper
335
+ source={theme.images.backgrounds.business_list_header}
336
+ style={{ paddingTop: top + 20 }}
337
+ resizeMode='stretch'
338
+ >
339
+ {!auth && (
340
+ <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
341
+ <OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
342
+ </TouchableOpacity>
343
+ )}
341
344
  </HeaderWrapper>
342
-
345
+ {!businessId && (
346
+ <SearchBar
347
+ onSearch={handleChangeSearch}
348
+ searchValue={searchValue}
349
+ lazyLoad
350
+ hideIcon
351
+ isCancelXButtonShow={!!searchValue}
352
+ onCancel={() => handleChangeSearch('')}
353
+ placeholder={t('SEARCH', 'Search')}
354
+ height={50}
355
+ isDisabled={!businessTypes}
356
+ inputContainerStyles={styles.inputContainerStyles}
357
+ containerStyles={{
358
+ marginHorizontal: 40,
359
+ marginTop: 20
360
+ }}
361
+ inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? { paddingBottom: 6 } : { paddingBottom: 4 } }}
362
+ onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
363
+ />
364
+ )}
343
365
  <OrderProgressWrapper>
344
366
  <OrderProgress
345
367
  {...props}
@@ -408,7 +430,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
408
430
  />
409
431
  )}
410
432
  {businessesList.businesses?.map(
411
- (business: any, i : number) => (
433
+ (business: any, i: number) => (
412
434
  <BusinessController
413
435
  key={`${business.id}_` + i}
414
436
  business={business}
@@ -15,6 +15,7 @@ export const Search = styled.View`
15
15
  justify-content: flex-end;
16
16
  align-items: center;
17
17
  margin-vertical: 10px;
18
+ margin-horizontal: 20px;
18
19
  `
19
20
 
20
21
  export const AddressInput = styled.TouchableOpacity`
@@ -39,7 +40,7 @@ export const OrderControlContainer = styled.View`
39
40
  `
40
41
 
41
42
  export const WrapMomentOption = styled.TouchableOpacity`
42
- background-color: ${(props: any) => props.theme.colors.backgroundGray100};
43
+ background-color: ${(props: any) => props.theme.colors.white};
43
44
  border-radius: 7.6px;
44
45
  font-size: 12px;
45
46
  max-width: 240px;
@@ -53,7 +54,7 @@ export const WrapMomentOption = styled.TouchableOpacity`
53
54
 
54
55
  export const HeaderWrapper = styled.ImageBackground`
55
56
  width: 100%;
56
- height: 370px;
57
+ height: 270px;
57
58
  padding: 20px 40px;
58
59
  background-color: transparent;
59
60
  `;
@@ -79,7 +80,14 @@ export const FarAwayMessage = styled.View`
79
80
  flex-direction: row;
80
81
  align-items: center;
81
82
  background-color: ${(props: any) => props.theme.colors.warning1};
82
- margin-bottom: 25px;
83
+ margin-bottom: 10px;
83
84
  border-radius: 7.6px;
84
85
  border: 1px solid ${(props: any) => props.theme.colors.warning5};
85
86
  `
87
+
88
+ export const AddressInputContainer = styled.View`
89
+ flex-direction: row;
90
+ width: 100%;
91
+ align-items: center;
92
+ justify-content: center
93
+ `
@@ -22,7 +22,10 @@ export const SearchBar = (props: any) => {
22
22
  isDisabled,
23
23
  iconCustomRight,
24
24
  onSubmitEditing,
25
- blurOnSubmit
25
+ blurOnSubmit,
26
+ inputContainerStyles,
27
+ containerStyles,
28
+ hideIcon
26
29
  } = props
27
30
 
28
31
  const theme = useTheme();
@@ -77,13 +80,13 @@ export const SearchBar = (props: any) => {
77
80
  }
78
81
 
79
82
  return (
80
- <Pressable style={[styles.container, { height: height }]}>
83
+ <Pressable style={[styles.container, containerStyles, { height: height }]}>
81
84
  <OInput
82
85
  value={searchValue}
83
86
  onChange={onChangeSearch}
84
- style={styles.inputStyle}
87
+ style={{...styles.inputStyle, ...inputContainerStyles}}
85
88
  placeholder={placeholder}
86
- icon={theme.images.general.search}
89
+ icon={!hideIcon && theme.images.general.search}
87
90
  isDisabled={isDisabled}
88
91
  iconStyle={{ width: 12 }}
89
92
  returnKeyType='done'