ordering-ui-react-native 0.21.64 → 0.21.65

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.21.64",
3
+ "version": "0.21.65",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useCallback } from 'react'
2
2
 
3
3
  import { Platform, StyleSheet, View, TouchableOpacity, ScrollView } from 'react-native';
4
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
4
5
 
5
6
  import { OButton, OText, OLink, OModal } from '../shared'
6
7
  import {
@@ -53,6 +54,7 @@ export const OrderContentComponent = (props: OrderContent) => {
53
54
  const WIDTH_SCREEN = orientationState?.dimensions?.width
54
55
 
55
56
  const [openReviewModal, setOpenReviewModal] = useState(false)
57
+ const [showCustomFields, setShowCustomFields] = useState<boolean>(false);
56
58
 
57
59
  const [isReadMore, setIsReadMore] = useState({
58
60
  customerAddress: false,
@@ -134,27 +136,36 @@ export const OrderContentComponent = (props: OrderContent) => {
134
136
 
135
137
  {order?.metafields?.length > 0 && (
136
138
  <OrderBusiness>
137
- <OText style={{ marginBottom: 5 }} size={16} weight="600">
138
- {t('CUSTOM_FIELDS', 'Custom fields')}
139
- </OText>
140
-
141
- {order.metafields.map((field: any) => (
142
- <View
143
- key={field.id}
144
- style={{
145
- width: '100%',
146
- flexDirection: 'row',
147
- marginBottom: 5
148
- }}
149
- >
150
- <OText style={{ width: '50%' }}>
151
- {field.key}
152
- </OText>
153
- <OText style={{ width: '45%', textAlign: 'right' }}>
154
- {field.value}
155
- </OText>
156
- </View>
157
- ))}
139
+ <TouchableOpacity onPress={() => setShowCustomFields((prev: boolean) => !prev)} style={{ flexDirection: 'row', width: '100%', justifyContent: 'space-between', alignItems: 'flex-start' }}>
140
+ <OText style={{ marginBottom: 5 }} size={16} weight="600">
141
+ {t('CUSTOM_FIELDS', 'Custom fields')}
142
+ </OText>
143
+ <AntDesignIcon
144
+ name={showCustomFields ? 'up' : 'down'}
145
+ size={14}
146
+ />
147
+ </TouchableOpacity>
148
+ {showCustomFields && (
149
+ <>
150
+ {order.metafields.map((field: any) => (
151
+ <View
152
+ key={field.id}
153
+ style={{
154
+ width: '100%',
155
+ flexDirection: 'row',
156
+ marginBottom: 5
157
+ }}
158
+ >
159
+ <OText style={{ width: '50%' }}>
160
+ {field.key}
161
+ </OText>
162
+ <OText style={{ width: '45%', textAlign: 'right' }}>
163
+ {field.value}
164
+ </OText>
165
+ </View>
166
+ ))}
167
+ </>
168
+ )}
158
169
  </OrderBusiness>
159
170
  )}
160
171
 
@@ -39,7 +39,6 @@ import { NotFoundSource } from '../NotFoundSource';
39
39
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
40
40
  const ProfileUI = (props: ProfileParams) => {
41
41
  const {
42
- navigation,
43
42
  formState,
44
43
  isEdit,
45
44
  validationFields,
@@ -48,9 +47,7 @@ const ProfileUI = (props: ProfileParams) => {
48
47
  cleanFormState,
49
48
  handleToggleAvalaibleStatusDriver,
50
49
  userState,
51
- isAvailableLoading,
52
- isAlsea,
53
- isHideDriverStatus
50
+ isAlsea
54
51
  } = props;
55
52
 
56
53
  const [{ user }] = useSession();
@@ -60,6 +57,8 @@ const ProfileUI = (props: ProfileParams) => {
60
57
  const { errors } = useForm();
61
58
  const theme = useTheme();
62
59
 
60
+ const isShowDriverStatus = user?.level === 4 && (props.isShowDriverStatus || (!props.isShowDriverStatus && !userState?.result?.result?.available))
61
+
63
62
  const [phoneInputData, setPhoneInputData] = useState({
64
63
  error: '',
65
64
  phone: {
@@ -116,7 +115,8 @@ const ProfileUI = (props: ProfileParams) => {
116
115
  maxWidth: 200,
117
116
  includeBase64: true,
118
117
  },
119
- (response: any) => {
118
+ (image: any) => {
119
+ const response = image?.assets[0];
120
120
  if (response.didCancel) {
121
121
  console.log('User cancelled image picker');
122
122
  } else if (response.errorMessage) {
@@ -346,7 +346,7 @@ const ProfileUI = (props: ProfileParams) => {
346
346
  />
347
347
  </CenterView>
348
348
 
349
- {user?.level === 4 && !isHideDriverStatus && (
349
+ {isShowDriverStatus && (
350
350
  <EnabledStatusDriver>
351
351
  <View style={{ flex: 1 }}>
352
352
  <OText
@@ -374,7 +374,7 @@ const ProfileUI = (props: ProfileParams) => {
374
374
  !userState?.result?.result?.available,
375
375
  )
376
376
  }
377
- disabled={userState?.loading}
377
+ disabled={userState?.loading || userState?.result?.result?.available}
378
378
  animationSpeed={200}
379
379
  />
380
380
  )}
@@ -57,7 +57,7 @@ export interface ProfileParams {
57
57
  showField?: any;
58
58
  isRequiredField?: any;
59
59
  isAlsea?: boolean;
60
- isHideDriverStatus?: boolean;
60
+ isShowDriverStatus?: boolean;
61
61
  }
62
62
 
63
63
  export interface AddressListParams {