ordering-ui-react-native 0.17.49 → 0.17.50

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.49",
3
+ "version": "0.17.50",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -95,6 +95,7 @@ import { LogoutButton } from './src/components/LogoutButton';
95
95
  import { UserFormDetailsUI } from './src/components/UserFormDetails';
96
96
  import { WalletTransactionItem } from './src/components/WalletTransactionItem';
97
97
  import { Promotions } from './src/components/Promotions'
98
+ import { PageBanner } from './src/components/PageBanner'
98
99
  import { USER_TYPE, ORDER_TYPES } from './src/config/constants'
99
100
 
100
101
  import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from './src/components/OrderSummary/styles';
@@ -257,6 +258,7 @@ export {
257
258
  UserFormDetailsUI,
258
259
  WalletTransactionItem,
259
260
  Promotions,
261
+ PageBanner,
260
262
  MyOrders,
261
263
  ORDER_TYPES,
262
264
  USER_TYPE,
@@ -42,6 +42,7 @@ import Animated from 'react-native-reanimated'
42
42
  import { ProfessionalFilter } from '../ProfessionalFilter';
43
43
  import { ServiceForm } from '../ServiceForm';
44
44
  import { BusinessesListing } from '../BusinessesListing/Layout/Original'
45
+ import { PageBanner } from '../PageBanner'
45
46
 
46
47
  const PIXELS_TO_SCROLL = 2000
47
48
 
@@ -403,6 +404,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
403
404
  />
404
405
  </ProfessionalFilterWrapper>
405
406
  )}
407
+ <PageBanner position='app_business_page' />
406
408
  <View
407
409
  style={{
408
410
  height: 8,
@@ -55,6 +55,7 @@ import { OrderProgress } from '../../../OrderProgress';
55
55
  import { useFocusEffect, useIsFocused } from '@react-navigation/native';
56
56
  import FastImage from 'react-native-fast-image';
57
57
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
58
+ import { PageBanner } from '../../../PageBanner'
58
59
 
59
60
  const PIXELS_TO_SCROLL = 2000;
60
61
 
@@ -549,6 +550,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
549
550
  />
550
551
  )
551
552
  }
553
+
554
+ <PageBanner position='app_business_listing' />
555
+
552
556
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
553
557
  <ListWrapper>
554
558
  {!businessId && (
@@ -0,0 +1,104 @@
1
+ import React from 'react'
2
+ import { useUtils, PageBanner as PageBannerController } from 'ordering-components/native'
3
+
4
+ import { View, StyleSheet } from 'react-native'
5
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
6
+ import Swiper from 'react-native-swiper'
7
+ import FastImage from 'react-native-fast-image';
8
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
9
+ import { useTheme } from 'styled-components/native';
10
+ import { PageBannerWrapper } from './styles'
11
+
12
+ const PageBannerUI = (props: any) => {
13
+ const {
14
+ pageBannerState
15
+ } = props
16
+
17
+ const theme = useTheme();
18
+ const [{ optimizeImage }] = useUtils();
19
+
20
+ const styles = StyleSheet.create({
21
+ mainSwiper: {
22
+ height: 300,
23
+ },
24
+ swiperButton: {
25
+ marginHorizontal: 25,
26
+ alignItems: 'center',
27
+ justifyContent: 'center',
28
+ width: 32,
29
+ height: 32,
30
+ borderRadius: 16,
31
+ backgroundColor: 'rgba(208,208,208,0.5)'
32
+ },
33
+ sliderWrapper: {
34
+ width: '100%',
35
+ height: 300
36
+ }
37
+ })
38
+
39
+ return (
40
+ <>
41
+ {pageBannerState.loading ? (
42
+ <PageBannerWrapper>
43
+ <Placeholder
44
+ Animation={Fade}
45
+ >
46
+ <PlaceholderLine
47
+ height={300}
48
+ style={{ marginBottom: 20, borderRadius: 8 }}
49
+ />
50
+ </Placeholder>
51
+ </PageBannerWrapper>
52
+ ) : (
53
+ <>
54
+ {pageBannerState.banner?.items && pageBannerState.banner?.items.length > 0 && (
55
+ <PageBannerWrapper>
56
+ <Swiper
57
+ loop={false}
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>
90
+ </PageBannerWrapper>
91
+ )}
92
+ </>
93
+ )}
94
+ </>
95
+ )
96
+ }
97
+
98
+ export const PageBanner = (props: any) => {
99
+ const pageBannerProps = {
100
+ ...props,
101
+ UIComponent: PageBannerUI
102
+ }
103
+ return <PageBannerController {...pageBannerProps} />
104
+ }
@@ -0,0 +1,8 @@
1
+ import styled, { css } from 'styled-components/native'
2
+
3
+ export const PageBannerWrapper = styled.View`
4
+ margin-horizontal: 40px;
5
+ border-radius: 8px;
6
+ overflow: hidden;
7
+ margin-vertical: 30px;
8
+ `