ordering-ui-react-native 0.12.69 → 0.12.73

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.69",
3
+ "version": "0.12.73",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -2,7 +2,7 @@ import styled from 'styled-components/native'
2
2
 
3
3
  export const ActiveOrdersContainer = styled.ScrollView`
4
4
  margin-bottom: 20px;
5
- height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '500px'};
5
+ height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '220px'};
6
6
  max-height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '220px'};
7
7
  `
8
8
 
@@ -150,11 +150,11 @@ export const OrderContentComponent = (props: OrderContent) => {
150
150
  {t('CUSTOMER_DETAILS', 'Customer details')}
151
151
  </OText>
152
152
  {
153
- (order?.customer?.name || order?.customer?.lastname) && (
153
+ (!!order?.customer?.name || !!order?.customer?.lastname) && (
154
154
  <View style={{ flexDirection: 'row' }}>
155
155
  <View style={{ flexDirection: 'row', justifyContent: 'space-between', flex: 1 }}>
156
156
  <View style={{ flexDirection: 'row' }}>
157
- {order?.customer?.name && (
157
+ {!!order?.customer?.name && (
158
158
  <OText
159
159
  numberOfLines={1}
160
160
  mBottom={4}
@@ -163,7 +163,7 @@ export const OrderContentComponent = (props: OrderContent) => {
163
163
  {order?.customer?.name}
164
164
  </OText>
165
165
  )}
166
- {order?.customer?.middle_name && (
166
+ {!!order?.customer?.middle_name && (
167
167
  <OText
168
168
  numberOfLines={1}
169
169
  mBottom={4}
@@ -172,7 +172,7 @@ export const OrderContentComponent = (props: OrderContent) => {
172
172
  {order?.customer?.middle_name}
173
173
  </OText>
174
174
  )}
175
- {order?.customer?.lastname && (
175
+ {!!order?.customer?.lastname && (
176
176
  <OText
177
177
  numberOfLines={1}
178
178
  mBottom={4}
@@ -182,7 +182,7 @@ export const OrderContentComponent = (props: OrderContent) => {
182
182
  </OText>
183
183
  )}
184
184
  {
185
- order?.customer?.second_lastname && (
185
+ !!order?.customer?.second_lastname && (
186
186
  <OText
187
187
  numberOfLines={1}
188
188
  mBottom={4}
@@ -193,7 +193,7 @@ export const OrderContentComponent = (props: OrderContent) => {
193
193
  )
194
194
  }
195
195
  </View>
196
- {order?.user_review?.qualification && (
196
+ {!!order?.user_review?.qualification && (
197
197
  <View style={{ flexDirection: 'row' }}>
198
198
  <MaterialIcon style={{ bottom: 2 }} name='star' size={24} color={theme.colors.arrowColor} />
199
199
  <OText mLeft={5}>
@@ -440,7 +440,7 @@ export const OrderContentComponent = (props: OrderContent) => {
440
440
  {parsePrice(order?.summary?.total ?? 0)}
441
441
  </OText>
442
442
  </Table>
443
- {order?.comment && (
443
+ {!!order?.comment && (
444
444
  <Table>
445
445
  <OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
446
446
  <OText style={{ maxWidth: '70%' }}>
@@ -2,7 +2,7 @@ import styled from 'styled-components/native'
2
2
 
3
3
  export const ActiveOrdersContainer = styled.ScrollView`
4
4
  margin-bottom: 20px;
5
- height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '500px'};
5
+ height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '220px'};
6
6
  max-height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '220px'};
7
7
  `
8
8
 
@@ -117,10 +117,8 @@ export const ActiveOrders = (props: ActiveOrdersParams) => {
117
117
  {pagination?.totalPages && pagination?.currentPage < pagination?.totalPages && (
118
118
  <LoadMore>
119
119
  <OButton
120
- bgColor={theme.colors.white}
121
- textStyle={{ color: theme.colors.primary, fontSize: 14 }}
120
+ textStyle={{ color: '#fff' }}
122
121
  text={t('LOAD_MORE_ORDERS', 'Load more orders')}
123
- borderColor={theme.colors.primary}
124
122
  onClick={loadMoreOrders}
125
123
  style={styles.loadMoreButton}
126
124
  />
@@ -154,9 +152,9 @@ const styles = StyleSheet.create({
154
152
  minWidth: 230,
155
153
  },
156
154
  loadMoreButton: {
157
- width: 200,
158
- height: 46,
155
+ width: '100%',
159
156
  marginLeft: 'auto',
160
157
  marginRight: 'auto',
158
+ borderRadius: 7.6
161
159
  },
162
160
  });
@@ -290,14 +290,6 @@ const AddressListUI = (props: AddressListParams) => {
290
290
  />
291
291
  </>
292
292
  )}
293
- {!isFromProfile && addressList?.addresses?.length > 0 && (
294
- <OButton
295
- text={t('CONTINUE', 'Continue')}
296
- style={styles.button}
297
- onClick={() => onNavigatorRedirect()}
298
- textStyle={{ color: theme.colors.white }}
299
- />
300
- )}
301
293
  </AddressListContainer>
302
294
  )}
303
295
  </Container>
@@ -5,7 +5,7 @@ export const BCContainer = styled.View`
5
5
  width: 100%;
6
6
  justify-content: flex-start;
7
7
  text-align: center;
8
- min-height: 45px;
8
+ min-height: 60px;
9
9
  `
10
10
 
11
11
  export const BusinessCategories = styled.View`
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import { View, StyleSheet, BackHandler, KeyboardAvoidingView, Platform } from 'react-native';
2
+ import { View, StyleSheet, BackHandler, KeyboardAvoidingView, Platform, Linking } from 'react-native';
3
3
  import Spinner from 'react-native-loading-spinner-overlay';
4
4
  import LinearGradient from 'react-native-linear-gradient';
5
5
  import { Messages } from '../Messages';
@@ -483,10 +483,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
483
483
  </OText>
484
484
  <Icons>
485
485
  <TouchableOpacity
486
- onPress={() =>
487
- props.navigation.navigate('Business', {
488
- store: businessData?.slug,
489
- })
486
+ onPress={() => order?.business?.cellphone &&
487
+ Linking.openURL(`tel:${order?.business?.cellphone}`)
490
488
  }
491
489
  style={{ paddingEnd: 5 }}>
492
490
  <OIcon
@@ -203,7 +203,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
203
203
  useDefualtSessionManager: true,
204
204
  paginationSettings: {
205
205
  initialPage: 1,
206
- pageSize: props.activeOrders || props.preOrders ? -1 : 10,
206
+ pageSize: 10,
207
207
  controlType: 'infinity'
208
208
  }
209
209
  }
@@ -314,6 +314,41 @@ export const UserFormDetailsUI = (props: any) => {
314
314
  )}
315
315
  </WrapperPhone>
316
316
  )}
317
+ <Controller
318
+ control={control}
319
+ render={() => (
320
+ <>
321
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
322
+ {t('PASSWORD', 'Password')}
323
+ </OText>
324
+ <OInput
325
+ name='password'
326
+ placeholder={t('FRONT_VISUALS_PASSWORD', 'Password')}
327
+ inputStyle={styles.inputStyle}
328
+ style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
329
+ autoCapitalize='none'
330
+ isDisabled={false}
331
+ value={
332
+ formState?.changes['password'] ??
333
+ (user && user['password']) ??
334
+ ''
335
+ }
336
+ onChange={(val: any) => {
337
+ setValue('password', val.target.value)
338
+ handleChangeInput(val)
339
+ }}
340
+ autoCorrect
341
+ type='default'
342
+ returnKeyType="done"
343
+ autoCompleteType='off'
344
+ isSecured
345
+ />
346
+ </>
347
+ )}
348
+ name='password'
349
+ rules={getInputRules({name: 'password', code: 'password'})}
350
+ defaultValue=''
351
+ />
317
352
  </UDWrapper>
318
353
  )}
319
354
  {validationFields?.loading && (
@@ -339,7 +374,7 @@ export const UserFormDetailsUI = (props: any) => {
339
374
  borderColor={theme.colors.primary}
340
375
  isDisabled={formState.loading}
341
376
  imgRightSrc={null}
342
- style={{ borderRadius: 7.6, shadowOpacity: 0, width: '100%', borderWidth: 1, marginTop: 20 }}
377
+ style={{ borderRadius: 7.6, shadowOpacity: 0, width: '100%', borderWidth: 1, marginTop: 20, marginBottom: 20 }}
343
378
  onClick={handleSubmit(onSubmit)}
344
379
  />
345
380
  )}
@@ -114,8 +114,9 @@ const ProfileUI = (props: ProfileParams) => {
114
114
  console.log('ImagePicker Error: ', response.errorMessage);
115
115
  showToast(ToastType.Error, response.errorMessage);
116
116
  } else {
117
- if (response.uri) {
118
- const url = `data:${response.type};base64,${response.base64}`;
117
+ if (response?.assets?.length > 0) {
118
+ const image = response?.assets[0]
119
+ const url = `data:${image.type};base64,${image.base64}`
119
120
  handleButtonUpdateClick(null, true, url);
120
121
  } else {
121
122
  showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
@@ -33,8 +33,8 @@ export const VerifyPhone = (props: any) => {
33
33
 
34
34
  const styles = StyleSheet.create({
35
35
  inputStyle: {
36
- width: 80,
37
- height: 80,
36
+ width: 75,
37
+ height: 75,
38
38
  marginBottom: 25,
39
39
  borderWidth: 1,
40
40
  borderColor: theme.colors.disabled,
@@ -50,12 +50,21 @@ export const VerifyPhone = (props: any) => {
50
50
  const [timer, setTimer] = useState(`${TIME_COUNTDOWN / 60}:00`)
51
51
  const [verifyCode, setVerifyCode] = useState({ 0: '', 1: '', 2: '', 3: '' })
52
52
  const [isSendCodeAgain, setIsSendCodeAgain] = useState(false)
53
+ const inputRefs: any = [
54
+ React.createRef(),
55
+ React.createRef(),
56
+ React.createRef(),
57
+ React.createRef()
58
+ ]
53
59
 
54
60
  const lastNumbers = phone?.cellphone &&
55
61
  `${phone?.cellphone.charAt(phone?.cellphone.length - 2)}${phone?.cellphone.charAt(phone?.cellphone.length - 1)}`
56
62
 
57
- const handleChangeCode = (val: number, i: number) => {
63
+ const goNextAfterEdit = (val: number, i: number) => {
58
64
  setVerifyCode({ ...verifyCode, [i]: val })
65
+ if(val && i < inputRefs.length - 1) {
66
+ inputRefs[i+1].focus()
67
+ }
59
68
  }
60
69
 
61
70
  const checkResult = (result: any) => {
@@ -141,14 +150,15 @@ export const VerifyPhone = (props: any) => {
141
150
  </CountDownContainer>
142
151
  </WrappCountdown>
143
152
  <InputsSection>
144
- {[...Array(4),].map((_: any, i: number) => (
153
+ {inputRefs.map((k: any, idx: number) => (
145
154
  <TextInput
146
- key={i}
155
+ key={idx}
147
156
  keyboardType='number-pad'
148
- placeholder={'0'}
149
- style={styles.inputStyle}
150
- onChangeText={(val: any) => handleChangeCode(val, i)}
157
+ ref={r => inputRefs[idx] = r}
151
158
  maxLength={1}
159
+ style={styles.inputStyle}
160
+ placeholder={'0'}
161
+ onChangeText={(val: any) => goNextAfterEdit(val, idx)}
152
162
  editable={timer !== '00:00'}
153
163
  />
154
164
  ))}
@@ -173,11 +183,11 @@ export const VerifyPhone = (props: any) => {
173
183
  </ErrorSection>
174
184
  )}
175
185
  <ResendSection>
176
- <OText size={17} style={{ marginRight: 5 }}>
186
+ <OText size={16} style={{ marginRight: 5 }}>
177
187
  {t('ARE_YOU_NOT_SEEING_THE_CODE', 'Are you not seeing the code?')}
178
188
  </OText>
179
189
  <Pressable onPress={() => handleSendCodeAgain()}>
180
- <OText size={17} color={theme.colors.primary}>
190
+ <OText size={16} color={theme.colors.primary}>
181
191
  {t('SEND_AGAIN', 'Send Again')}
182
192
  </OText>
183
193
  </Pressable>
@@ -3,8 +3,8 @@ import styled from 'styled-components/native';
3
3
  export const Container = styled.View`
4
4
  width: 100%;
5
5
  padding-top: 5px;
6
- padding-left: 20px;
7
- padding-right: 20px;
6
+ padding-left: 40px;
7
+ padding-right: 40px;
8
8
  `
9
9
 
10
10
  export const CountDownContainer = styled.View`
@@ -73,8 +73,9 @@ const AccountUI = (props: AccountParams) => {
73
73
  console.log('ImagePicker Error: ', response.errorMessage);
74
74
  showToast(ToastType.Error, response.errorMessage);
75
75
  } else {
76
- if (response.uri) {
77
- const url = `data:${response.type};base64,${response.base64}`
76
+ if (response?.assets?.[0]?.uri) {
77
+ const image = response?.assets?.[0]
78
+ const url = `data:${image?.type};base64,${image?.base64}`;
78
79
  handleButtonUpdateClick(null, true, url);
79
80
  } else {
80
81
  showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
@@ -2,7 +2,7 @@ import styled from 'styled-components/native'
2
2
 
3
3
  export const ActiveOrdersContainer = styled.ScrollView`
4
4
  margin-bottom: 20px;
5
- height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '500px'};
5
+ height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '220px'};
6
6
  max-height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '220px'};
7
7
  `
8
8
 
@@ -300,14 +300,6 @@ const AddressListUI = (props: AddressListParams) => {
300
300
  />
301
301
  </>
302
302
  )}
303
- {!isFromProfile && addressList?.addresses?.length > 0 && (
304
- <OButton
305
- text={t('CONTINUE', 'Continue')}
306
- style={styles.button}
307
- onClick={() => onNavigatorRedirect()}
308
- textStyle={{ color: theme.colors.white }}
309
- />
310
- )}
311
303
  </AddressListContainer>
312
304
  )}
313
305
  </Container>
@@ -1,8 +1,13 @@
1
1
  import React from 'react';
2
- import styled from 'styled-components/native';
2
+ import { Platform } from 'react-native';
3
+ import styled, { css } from 'styled-components/native';
3
4
 
4
5
  const ContainerStyled = styled.ScrollView`
5
6
  flex: 1;
7
+ ${(props: any) => !props.nopadding && css`
8
+ padding: ${Platform.OS === 'ios' ? '0px 30px 0px' : '30px'};
9
+ `}
10
+ background-color: ${(props: any) => props.theme.colors.backgroundPage};
6
11
  `;
7
12
 
8
13
  const SafeAreaStyled = styled.SafeAreaView`
@@ -10,19 +15,13 @@ const SafeAreaStyled = styled.SafeAreaView`
10
15
  background-color: ${(props: any) => props.theme.colors.backgroundPage};
11
16
  `;
12
17
 
13
- const ContentView = styled.View`
14
- padding-horizontal: 30px;
15
- `
16
-
17
18
 
18
19
  export const Container = (props: any) => {
19
20
  return (
20
21
  <SafeAreaStyled>
21
- <ContainerStyled ref={props?.forwardRef} keyboardShouldPersistTaps='handled'>
22
- <ContentView>
22
+ <ContainerStyled ref={props?.forwardRef} style={props?.style} {...props} keyboardShouldPersistTaps='handled'>
23
23
  {props.children}
24
- </ContentView>
25
24
  </ContainerStyled>
26
25
  </SafeAreaStyled>
27
26
  )
28
- }
27
+ }