ordering-ui-react-native 0.17.64 → 0.17.66

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.17.64",
3
+ "version": "0.17.66",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -538,17 +538,21 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
538
538
  </FeaturedWrapper>
539
539
  )
540
540
  }
541
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
542
- {
543
- !businessId && !props.franchiseId && (
544
- <HighestRatedBusinesses
545
- onBusinessClick={handleBusinessClick}
546
- navigation={navigation}
547
- favoriteIds={favoriteIds}
548
- setFavoriteIds={setFavoriteIds}
549
- />
550
- )
551
- }
541
+ {!isChewLayout && (
542
+ <>
543
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
544
+ {
545
+ !businessId && !props.franchiseId && (
546
+ <HighestRatedBusinesses
547
+ onBusinessClick={handleBusinessClick}
548
+ navigation={navigation}
549
+ favoriteIds={favoriteIds}
550
+ setFavoriteIds={setFavoriteIds}
551
+ />
552
+ )
553
+ }
554
+ </>
555
+ )}
552
556
 
553
557
  <PageBanner position='app_business_listing' />
554
558
 
@@ -16,24 +16,24 @@ const BusinessControllerList = ({ businesses, onBusinessClick, navigation, order
16
16
  return (
17
17
  <>
18
18
  {businesses?.result?.map((business: any, i: number) => (
19
- <BusinessController
20
- key={`${business.id}_` + i}
21
- business={business}
22
- isBusinessOpen={business.open}
23
- handleCustomClick={() => onBusinessClick(business)}
24
- orderType={orderState?.options?.type}
25
- navigation={navigation}
26
- businessHeader={business?.header}
27
- businessFeatured={business?.featured}
28
- businessLogo={business?.logo}
29
- businessReviews={business?.reviews}
30
- businessDeliveryPrice={business?.delivery_price}
31
- businessDeliveryTime={business?.delivery_time}
32
- businessPickupTime={business?.pickup_time}
33
- businessDistance={business?.distance}
34
- handleCustomUpdate={handleCustomUpdate}
35
- style={style}
36
- />
19
+ <View style={style} key={`${business.id}_` + i}>
20
+ <BusinessController
21
+ business={business}
22
+ isBusinessOpen={business.open}
23
+ handleCustomClick={() => onBusinessClick(business)}
24
+ orderType={orderState?.options?.type}
25
+ navigation={navigation}
26
+ businessHeader={business?.header}
27
+ businessFeatured={business?.featured}
28
+ businessLogo={business?.logo}
29
+ businessReviews={business?.reviews}
30
+ businessDeliveryPrice={business?.delivery_price}
31
+ businessDeliveryTime={business?.delivery_time}
32
+ businessPickupTime={business?.pickup_time}
33
+ businessDistance={business?.distance}
34
+ handleCustomUpdate={handleCustomUpdate}
35
+ />
36
+ </View>
37
37
  ))}
38
38
  </>
39
39
  )
@@ -109,7 +109,12 @@ export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) =>
109
109
  });
110
110
 
111
111
  return (
112
- <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
112
+ <ScrollView
113
+ horizontal={isBusinessesSearchList}
114
+ style={styles.container}
115
+ showsVerticalScrollIndicator={false}
116
+ showsHorizontalScrollIndicator={false}
117
+ >
113
118
  {isBusinessesSearchList ? (
114
119
  <>
115
120
  {!businesses?.loading && (
@@ -1,13 +1,13 @@
1
- import React from 'react'
1
+ import React, { useRef } from 'react'
2
2
  import { useUtils, PageBanner as PageBannerController } from 'ordering-components/native'
3
3
 
4
- import { View, StyleSheet } from 'react-native'
4
+ import { View, StyleSheet, Dimensions, TouchableOpacity } from 'react-native'
5
5
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
6
- import Swiper from 'react-native-swiper'
6
+ import Carousel from 'react-native-snap-carousel'
7
7
  import FastImage from 'react-native-fast-image';
8
8
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
9
9
  import { useTheme } from 'styled-components/native';
10
- import { PageBannerWrapper } from './styles'
10
+ import { PageBannerWrapper, ArrowButtonsContainer } from './styles'
11
11
 
12
12
  const PageBannerUI = (props: any) => {
13
13
  const {
@@ -16,6 +16,9 @@ const PageBannerUI = (props: any) => {
16
16
 
17
17
  const theme = useTheme();
18
18
  const [{ optimizeImage }] = useUtils();
19
+ const carouselRef = useRef(null)
20
+
21
+ const windowWidth = Dimensions.get('window').width;
19
22
 
20
23
  const styles = StyleSheet.create({
21
24
  mainSwiper: {
@@ -36,6 +39,18 @@ const PageBannerUI = (props: any) => {
36
39
  }
37
40
  })
38
41
 
42
+ const renderItem = ({ item, index }) => {
43
+ return (
44
+ <View style={styles.sliderWrapper}>
45
+ <FastImage
46
+ style={{ height: '100%', width: '100%' }}
47
+ resizeMode='cover'
48
+ source={{ uri: optimizeImage(item.url, 'h_300,c_limit') }}
49
+ />
50
+ </View>
51
+ )
52
+ }
53
+
39
54
  return (
40
55
  <>
41
56
  {pageBannerState.loading ? (
@@ -53,40 +68,40 @@ const PageBannerUI = (props: any) => {
53
68
  <>
54
69
  {pageBannerState.banner?.items && pageBannerState.banner?.items.length > 0 && (
55
70
  <PageBannerWrapper>
56
- <Swiper
71
+ <ArrowButtonsContainer>
72
+ <TouchableOpacity
73
+ style={styles.swiperButton}
74
+ onPress={() => carouselRef.current.snapToPrev()}
75
+ >
76
+ <IconAntDesign
77
+ name="caretleft"
78
+ color={theme.colors.white}
79
+ size={13}
80
+ />
81
+ </TouchableOpacity>
82
+ <TouchableOpacity
83
+ style={styles.swiperButton}
84
+ onPress={() => carouselRef.current.snapToNext()}
85
+ >
86
+ <IconAntDesign
87
+ name="caretright"
88
+ color={theme.colors.white}
89
+ size={13}
90
+ />
91
+ </TouchableOpacity>
92
+ </ArrowButtonsContainer>
93
+ <Carousel
94
+ ref={carouselRef}
57
95
  loop={pageBannerState.banner?.items.length > 1}
58
- showsButtons={true}
59
- style={styles.mainSwiper}
60
- showsPagination={false}
61
- prevButton={
62
- <View style={styles.swiperButton}>
63
- <IconAntDesign
64
- name="caretleft"
65
- color={theme.colors.white}
66
- size={13}
67
- />
68
- </View>
69
- }
70
- nextButton={
71
- <View style={styles.swiperButton}>
72
- <IconAntDesign
73
- name="caretright"
74
- color={theme.colors.white}
75
- size={13}
76
- />
77
- </View>
78
- }
79
- >
80
- {pageBannerState.banner?.items.map((img, i) => (
81
- <View key={i} style={styles.sliderWrapper}>
82
- <FastImage
83
- style={{ height: '100%', width: '100%' }}
84
- resizeMode='cover'
85
- source={{ uri: optimizeImage(img.url, 'h_300,c_limit') }}
86
- />
87
- </View>
88
- ))}
89
- </Swiper>
96
+ data={pageBannerState.banner?.items}
97
+ renderItem={renderItem}
98
+ sliderWidth={windowWidth - 80}
99
+ itemWidth={windowWidth - 80}
100
+ inactiveSlideScale={1}
101
+ pagingEnabled
102
+ removeClippedSubviews={false}
103
+ inactiveSlideOpacity={1}
104
+ />
90
105
  </PageBannerWrapper>
91
106
  )}
92
107
  </>
@@ -1,8 +1,18 @@
1
- import styled, { css } from 'styled-components/native'
1
+ import styled from 'styled-components/native'
2
2
 
3
3
  export const PageBannerWrapper = styled.View`
4
4
  margin-horizontal: 40px;
5
5
  border-radius: 8px;
6
6
  overflow: hidden;
7
7
  margin-vertical: 30px;
8
+ position: relative;
9
+ flex-direction: row;
10
+ align-items: center;
11
+ `
12
+ export const ArrowButtonsContainer = styled.View`
13
+ position: absolute;
14
+ z-index: 100;
15
+ flex-direction: row;
16
+ justify-content: space-between;
17
+ width: 100%;
8
18
  `