ordering-ui-react-native 0.12.0 → 0.12.1

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.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -55,6 +55,11 @@ export const BusinessBasicInformation = (
55
55
  return _types.join(', ');
56
56
  };
57
57
 
58
+ const onNavigationRedirect = (page: string, params: any) => {
59
+ if (!page) return
60
+ navigation.navigate(page, params);
61
+ }
62
+
58
63
  return (
59
64
  <BusinessContainer>
60
65
  <BusinessHeader
@@ -150,7 +155,12 @@ export const BusinessBasicInformation = (
150
155
  {business?.name}
151
156
  </OText>
152
157
  {!isBusinessInfoShow && (
153
- <WrapBusinessInfo onPress={() => setOpenBusinessInformation(true)}>
158
+ <WrapBusinessInfo
159
+ onPress={() => onNavigationRedirect(
160
+ 'BusinessInformation',
161
+ { businessState, business }
162
+ )}
163
+ >
154
164
  <OIcon src={theme.images.general.info} width={16} color={theme.colors.textSecondary} />
155
165
  </WrapBusinessInfo>
156
166
  )}
@@ -227,7 +237,7 @@ export const BusinessBasicInformation = (
227
237
  )}
228
238
  </WrapReviews>
229
239
  </BusinessInfo>
230
- <OModal
240
+ {/* <OModal
231
241
  titleSectionStyle={styles.modalTitleSectionStyle}
232
242
  open={openBusinessInformation}
233
243
  onClose={() => setOpenBusinessInformation(false)}
@@ -236,7 +246,7 @@ export const BusinessBasicInformation = (
236
246
  businessState={businessState}
237
247
  business={business}
238
248
  />
239
- </OModal>
249
+ </OModal> */}
240
250
  <OModal
241
251
  entireModal
242
252
  titleSectionStyle={styles.modalTitleSectionStyle}
@@ -62,4 +62,4 @@ export const DropOptionButton = styled.TouchableOpacity`
62
62
  padding-horizontal: 8px;
63
63
  flex-direction: row;
64
64
  margin-end: 12px;
65
- `
65
+ `
@@ -1,10 +1,11 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import {
3
3
  BusinessInformation as BusinessInformationController,
4
4
  useLanguage, useUtils
5
5
  } from 'ordering-components/native';
6
6
  import { useTheme } from 'styled-components/native';
7
- import { OIcon, OText } from '../shared';
7
+ import { SliderBox } from 'react-native-image-slider-box';
8
+ import { OIcon, OText, OModal } from '../shared';
8
9
  import {
9
10
  BusinessInformationContainer,
10
11
  WrapMainContent,
@@ -16,17 +17,21 @@ import {
16
17
  DivideView,
17
18
  MediaWrapper,
18
19
  } from './styles';
19
- import { Platform, StyleSheet, View } from 'react-native';
20
+ import { Platform, StyleSheet, TouchableOpacity, View } from 'react-native';
20
21
  import { BusinessInformationParams } from '../../types';
21
22
  import { GoogleMap } from '../GoogleMap';
22
23
  import { WebView } from 'react-native-webview';
24
+ import NavBar from '../../../../../src/components/NavBar'
23
25
 
24
26
  const BusinessInformationUI = (props: BusinessInformationParams) => {
25
- const { businessState, businessSchedule, businessLocation } = props;
27
+ const { businessState, business, businessSchedule, businessLocation } = props;
26
28
 
27
29
  const theme = useTheme();
28
30
  const [, t] = useLanguage();
29
31
  const [{ optimizeImage }] = useUtils();
32
+
33
+ const [openImages, setOpenImages] = useState(false)
34
+
30
35
  const daysOfWeek = [
31
36
  t('SUNDAY_ABBREVIATION', 'Sun'),
32
37
  t('MONDAY_ABBREVIATION', 'Mon'),
@@ -69,7 +74,7 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
69
74
  return vAry;
70
75
  };
71
76
  const bImages: any = () => {
72
- const len = businessState?.business?.gallery?.length | 0;
77
+ const len = businessState?.business?.gallery?.length ?? 0;
73
78
  if (len == 0) return [];
74
79
  const iAry = businessState?.business?.gallery.filter(
75
80
  ({ type, video }: any) => type == 1 && video == null,
@@ -79,6 +84,10 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
79
84
 
80
85
  return (
81
86
  <BusinessInformationContainer>
87
+ <NavBar
88
+ style={{ paddingBottom: 0 }}
89
+ onActionLeft={() => props.navigation?.canGoBack() && props.navigation.goBack()}
90
+ />
82
91
  <WrapMainContent contentContainerStyle={{}}>
83
92
  <InnerContent>
84
93
  <OText size={24} weight={Platform.OS === 'ios' ? '600' : 'bold'}>
@@ -89,7 +98,7 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
89
98
  {t('BUSINESS_LOCATION', 'Business Location')}
90
99
  </OText>
91
100
  </GrayBackground>
92
- {businessLocation.location && (
101
+ {!!businessLocation.location && (
93
102
  <WrapBusinessMap style={styles.wrapMapStyle}>
94
103
  <GoogleMap
95
104
  readOnly
@@ -107,7 +116,7 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
107
116
  {t('OPENING_TIME', 'Opening Time')}
108
117
  </OText>
109
118
  </GrayBackground>
110
- {businessSchedule && businessSchedule?.length > 0 && (
119
+ {!!businessSchedule && businessSchedule?.length > 0 && (
111
120
  <WrapScheduleBlock>
112
121
  {businessSchedule.map((schedule: any, i: number) => (
113
122
  <ScheduleBlock key={i}>
@@ -164,19 +173,41 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
164
173
  {t('IMAGES', 'Images')}
165
174
  </OText>
166
175
  </GrayBackground>
176
+
167
177
  <MediaWrapper horizontal>
168
- {bImages().map((i: any) => (
169
- i.file != null &&
170
- <View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
171
- <OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
172
- </View>
173
- ))}
178
+ {bImages().map((i: any) => ( i.file != null && (
179
+ <View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
180
+ <TouchableOpacity onPress={() => setOpenImages(true)}>
181
+ <OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
182
+ </TouchableOpacity>
183
+ </View>
184
+ )))}
174
185
  </MediaWrapper>
175
186
  </>
176
187
  )}
177
188
  </>
178
189
  </InnerContent>
179
190
  </WrapMainContent>
191
+ <OModal
192
+ titleSectionStyle={styles.modalTitleSectionStyle}
193
+ open={openImages}
194
+ onClose={() => setOpenImages(false)}
195
+ isNotDecoration
196
+ >
197
+ <View style={{ height: '100%', flexDirection: 'row', justifyContent: 'center', alignItems: 'center'}}>
198
+ <View style={{ marginTop: 20, height: 200}}>
199
+ <SliderBox
200
+ // circleLoop
201
+ sliderBoxHeight={200}
202
+ images={bImages().map((image: any) => optimizeImage(image?.file, 'h_300,c_limit'))}
203
+ dotColor={theme.colors.primary}
204
+ inactiveDotColor={theme.colors.backgroundGray}
205
+ dotStyle={styles.dotStyle}
206
+ activeOpacity={1}
207
+ />
208
+ </View>
209
+ </View>
210
+ </OModal>
180
211
  </BusinessInformationContainer>
181
212
  );
182
213
  };
@@ -187,6 +218,21 @@ const styles = StyleSheet.create({
187
218
  marginTop: 15,
188
219
  marginBottom: 10,
189
220
  },
221
+ dotStyle: {
222
+ width: 15,
223
+ height: 15,
224
+ borderRadius: 15,
225
+ marginHorizontal: 10,
226
+ padding: 0,
227
+ margin: 0
228
+ },
229
+ modalTitleSectionStyle: {
230
+ position: 'absolute',
231
+ width: '100%',
232
+ top: 0,
233
+ zIndex: 100,
234
+ left: 40
235
+ },
190
236
  });
191
237
 
192
238
  export const BusinessInformation = (props: BusinessInformationParams) => {
@@ -8,7 +8,7 @@ export const GrayBackground = styled.View`
8
8
  margin-top: 27px;
9
9
  `
10
10
  export const WrapMainContent = styled.ScrollView`
11
- margin-top: 40px;
11
+ /* margin-top: 40px; */
12
12
  `
13
13
  export const MediaWrapper = styled.ScrollView`
14
14
  margin-top: 16px;
@@ -36,4 +36,4 @@ export const DivideView = styled.View`
36
36
  height: 8px;
37
37
  background-color: ${(props: any) => props.theme.colors.backgroundGray100};
38
38
  margin-horizontal: -40px;
39
- `;
39
+ `;
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { View, StyleSheet } from 'react-native';
3
3
  import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
4
-
4
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
5
  import {
6
6
  Checkout as CheckoutController,
7
7
  useOrder,
@@ -22,6 +22,10 @@ import { PaymentOptions } from '../PaymentOptions';
22
22
  import { DriverTips } from '../DriverTips';
23
23
  import { NotFoundSource } from '../NotFoundSource';
24
24
  import { UserDetails } from '../UserDetails';
25
+ import { FloatingButton } from '../FloatingButton';
26
+ import { Container } from '../../layouts/Container';
27
+ import NavBar from '../NavBar';
28
+ import { OrderSummary } from '../OrderSummary';
25
29
 
26
30
  import {
27
31
  ChContainer,
@@ -36,12 +40,7 @@ import {
36
40
  ChUserDetails,
37
41
  ChCart
38
42
  } from './styles';
39
- import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
40
43
 
41
- import { FloatingButton } from '../FloatingButton';
42
- import { Container } from '../../layouts/Container';
43
- import NavBar from '../NavBar';
44
- import { OrderSummary } from '../OrderSummary';
45
44
  import { getTypesText } from '../../utils';
46
45
 
47
46
  const mapConfigs = {
@@ -84,6 +84,7 @@ const DriverTipsUI = (props: any) => {
84
84
  <TouchableOpacity
85
85
  key={i}
86
86
  onPress={() => handleChangeOpt(option)}
87
+ disabled={loading}
87
88
  >
88
89
  <DTCard
89
90
  style={style.circle}
@@ -13,21 +13,22 @@ export const DTWrapperTips = styled.View`
13
13
  display: flex;
14
14
  flex-direction: row;
15
15
  width: 100%;
16
- justify-content: space-between;
16
+ justify-content: space-evenly;
17
17
  align-items: center;
18
18
  flex-wrap: wrap;
19
19
  `
20
20
 
21
21
  export const DTCard = styled.View`
22
+ display: flex;
22
23
  justify-content: center;
23
24
  align-items: center;
24
- padding: 10px;
25
- border: 1px solid ${(props: any) => props.isActive ? props.theme.colors.primary : props.theme.colors.border};
25
+ padding: 15px;
26
+ border: 1px solid ${(props: any) => props.theme.colors.whiteGray};
26
27
  text-transform: capitalize;
27
- min-height: 48px;
28
- min-width: 48px;
29
- width: 48px;
30
- height: 48px;
28
+ min-height: 60px;
29
+ min-width: 60px;
30
+ margin-right: 10px;
31
+ margin-top: 10px;
31
32
 
32
33
  ${(props: any) => props.isActive && css`
33
34
  background-color: ${(props: any) => props.theme.colors.primary};
@@ -45,11 +46,11 @@ export const DTForm = styled.View`
45
46
  export const DTLabel = styled.Text`
46
47
  font-size: 10px;
47
48
  align-self: flex-start;
48
- color: ${(props: any) => props.theme.colors.textSecondary}
49
+ color: ${(props: any) => props.theme.colors.textSecondary};
49
50
  ${(props: any) => props.theme?.rtl && css`
50
51
  margin-left: 20px;
51
52
  margin-right: 0;
52
- `}
53
+ `};
53
54
  margin-top: 5px;
54
55
  margin-bottom: 17px;
55
56
  `
@@ -134,7 +134,7 @@ const PaymentOptionsUI = (props: any) => {
134
134
  />
135
135
  <OText
136
136
  size={10}
137
- style={{ marginStart: 12 }}
137
+ style={{ marginLeft: 12 }}
138
138
  color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
139
139
  >
140
140
  {t(item.gateway.toUpperCase(), item.name)}
@@ -151,19 +151,21 @@ const PaymentOptionsUI = (props: any) => {
151
151
  return (
152
152
  <PMContainer>
153
153
  {paymethodsList.paymethods.length > 0 && (
154
- <PMDropDownWrapper onPress={() => setShowMethods(true)}>
155
- <OText color={theme.colors.textSecondary} style={{marginStart: 14}}>{paymethodSelected?.paymethod?.name || t('SELECT_PAYMENT_METHOD', 'Select Paymethod')}</OText>
156
- <OIcon color={theme.colors.textSecondary} width={16} src={theme.images.general.chevron_right} style={{transform: [{rotate: '90deg'}], marginEnd: 14}} />
157
- {isShowMethods && <PMDropDownCont>
158
- {
159
- pmData.map((item: any, idx: number) =>
160
- <React.Fragment key={idx}>
161
- {renderPaymethods({item})}
162
- </React.Fragment>
163
- )
164
- }
165
- </PMDropDownCont>}
166
- </PMDropDownWrapper>
154
+ <View style={{ flexDirection: 'column' }}>
155
+ <PMDropDownWrapper onPress={() => setShowMethods(!isShowMethods)}>
156
+ <OText color={theme.colors.textSecondary} style={{marginLeft: 14}}>{paymethodSelected?.paymethod?.name || t('SELECT_PAYMENT_METHOD', 'Select Paymethod')}</OText>
157
+ <OIcon color={theme.colors.textSecondary} width={16} src={theme.images.general.chevron_right} style={{transform: [{rotate: '90deg'}], marginEnd: 14}} />
158
+ </PMDropDownWrapper>
159
+ {isShowMethods && (
160
+ <PMDropDownCont>
161
+ {pmData.map((item: any, idx: number) =>
162
+ <TouchableOpacity key={idx} onPress={() => console.log('asdasdasda')}>
163
+ {renderPaymethods({item})}
164
+ </TouchableOpacity>
165
+ )}
166
+ </PMDropDownCont>
167
+ )}
168
+ </View>
167
169
  )}
168
170
 
169
171
  {(paymethodsList.loading || isLoading) && (
@@ -66,11 +66,9 @@ export const PMDropDownWrapper = styled.TouchableOpacity`
66
66
  `;
67
67
 
68
68
  export const PMDropDownCont = styled.View`
69
- background-color: white;
70
- border-radius: 7.6px;
71
- position: absolute;
72
- top: 44px;
69
+ border-radius: 8px;
73
70
  width: 100%;
74
- padding: 10px 16px;
71
+ padding: 10px 0 0;
75
72
  box-shadow: 0 2px 3px #0000004D;
76
- `;
73
+ z-index: 99999;
74
+ `;