ordering-ui-react-native 0.32.43-test → 0.33.43-test

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.32.43-test",
3
+ "version": "0.33.43-test",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -132,6 +132,10 @@ const MapViewComponent = (props: MapViewParams) => {
132
132
 
133
133
  const RenderMarker = ({ marker, customer, orderIds }: { marker: any, customer?: boolean, orderIds?: Array<number> }) => {
134
134
  const markerRef = useRef<any>()
135
+
136
+ let coordinateLat = (customer ? marker?.customer?.location?.lat : marker?.business?.location?.lat) ?? initialPosition?.latitude
137
+ let coordinateLng = (customer ? marker?.customer?.location?.lng : marker?.business?.location?.lng) ?? initialPosition?.longitude
138
+
135
139
  useEffect(() => {
136
140
  if (
137
141
  markerRef?.current?.props?.coordinate?.latitude === locationSelected?.latitude &&
@@ -145,8 +149,8 @@ const MapViewComponent = (props: MapViewParams) => {
145
149
  <Marker
146
150
  key={customer ? marker?.customer?.id : marker?.business?.id}
147
151
  coordinate={{
148
- latitude: customer ? marker?.customer?.location?.lat : marker?.business?.location?.lat,
149
- longitude: customer ? marker?.customer?.location?.lng : marker?.business?.location?.lng
152
+ latitude: coordinateLat,
153
+ longitude: coordinateLng
150
154
  }}
151
155
  onPress={() =>
152
156
  setLocationSelected({
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import DatePicker from 'react-native-date-picker'
3
+ import { DateContainer } from './styles';
4
+
5
+ export const DatePickerUI = (props: any) => {
6
+ const {
7
+ birthdate,
8
+ handleChangeDate
9
+ } = props;
10
+
11
+ return (
12
+ <DateContainer>
13
+ <DatePicker mode="date" date={birthdate ? new Date(birthdate) : new Date()} onDateChange={handleChangeDate} />
14
+ </DateContainer>
15
+ );
16
+ };
17
+
@@ -0,0 +1,20 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const DateContainer = styled.View`
4
+ display: flex;
5
+ align-items: center;
6
+ margin-bottom: 20px;
7
+
8
+ input {
9
+ border-radius: 20px;
10
+ width: 140px;
11
+ outline: none;
12
+ padding: 10px 15px;
13
+ border: 1px solid #E9ECEF;
14
+ }
15
+
16
+ .react-datepicker__triangle {
17
+ transform: translate(40px, 0px) !important;
18
+ }
19
+
20
+ `
@@ -125,6 +125,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
125
125
  const directionTypes = [2, 3, 4, 5]
126
126
  const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
127
127
  const reorderStatus = [1, 2, 5, 6, 10, 11, 12]
128
+ const [isPickup, setIsPickup] = useState(order?.delivery_type === 2)
128
129
  const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
129
130
  const isGiftCardOrder = !order?.business_id
130
131
  const hideDeliveryDate = theme?.confirmation?.components?.order?.components?.date?.hidden
@@ -138,6 +139,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
138
139
  const hideDriverMessages = theme?.confirmation?.components?.driver?.components?.messages?.hidden
139
140
  const hideCustomerPhone = theme?.confirmation?.components?.customer?.components?.phone?.hidden
140
141
  const hideCustomerAddress = theme?.confirmation?.components?.customer?.components?.address?.hidden
142
+ const progressBarObjt = isPickup ? getOrderStatuPickUp : getOrderStatus
141
143
  const walletName: any = {
142
144
  cash: {
143
145
  name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
@@ -346,7 +348,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
346
348
  }
347
349
  }, [props?.order?.error, props?.order?.loading])
348
350
 
349
- const progressBarObjt = order?.delivery_type && props.order?.delivery_type === 2 ? getOrderStatuPickUp : getOrderStatus
351
+
352
+ useEffect(() => {
353
+ if (!order?.delivery_type) return
354
+ setIsPickup(order?.delivery_type === 2)
355
+ }, [order?.delivery_type])
350
356
 
351
357
  return (
352
358
  <OrderDetailsContainer
@@ -14,8 +14,7 @@ import { PhoneInputNumber } from '../PhoneInputNumber';
14
14
  import { sortInputFields } from '../../utils';
15
15
  import { ListItem } from '../UserProfile/styles';
16
16
  import moment from 'moment';
17
- import DateTimePickerModal from "react-native-modal-datetime-picker";
18
- import DatePicker from 'react-native-date-picker'
17
+ import { DatePickerUI } from '../DatePicker';
19
18
 
20
19
  export const UserFormDetailsUI = (props: any) => {
21
20
  const {
@@ -85,6 +84,7 @@ export const UserFormDetailsUI = (props: any) => {
85
84
  const [isChanged, setIsChanged] = useState(false)
86
85
  const [isModalOpen, setIsModalOpen] = useState(false)
87
86
  const [birthdate, setBirthdate] = useState(user?.birthdate ?? null)
87
+ const [showDatePicker, setShowDatePicker] = useState(false)
88
88
  const [phoneInputData, setPhoneInputData] = useState({
89
89
  error: '',
90
90
  phone: {
@@ -216,6 +216,7 @@ export const UserFormDetailsUI = (props: any) => {
216
216
  setBirthdate(date)
217
217
  const _birthdate = moment(date).format('YYYY-MM-DD')
218
218
  handleChangeInput({ target: { name: 'birthdate', value: _birthdate } })
219
+ setShowDatePicker(false)
219
220
  }
220
221
 
221
222
  const onRemoveAccount = () => {
@@ -384,37 +385,14 @@ export const UserFormDetailsUI = (props: any) => {
384
385
  <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
385
386
  {t('BIRTHDATE', 'Birthdate')}
386
387
  </OText>
387
- <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ alignSelf: 'flex-start' }}>
388
- {birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
389
- </OText>
390
- {/* <TouchableOpacity
391
- onPress={() => setDatePickerVisibility(true)}>
392
- <OInput
393
- style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
394
- value={birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
395
- editable={false}
396
- />
397
- </TouchableOpacity> */}
398
- {/* <OButton
399
- text={t('SELECT_A_DATE', 'Select a Date')}
400
- bgColor={theme.colors.primary}
401
- textStyle={{ color: theme.colors.white, fontSize: 14 }}
402
- borderColor={theme.colors.primary}
403
- isDisabled={formState.loading}
404
- imgRightSrc={null}
405
- style={{ borderRadius: 7.6, shadowOpacity: 0, borderWidth: 1, marginTop: 20, marginBottom: 20 }}
406
- onClick={() => setDatePickerVisibility(true)}
407
- /> */}
408
- {/* <DateContainer> */}
409
- {/* <DateTimePickerModal
410
- isVisible={isDatePickerVisible}
411
- mode="date"
412
- date={birthdate ? new Date(birthdate) : new Date()}
413
- onConfirm={_handleChangeDate}
414
- onCancel={() => setDatePickerVisibility(false)}
415
- /> */}
416
- {/* </DateContainer> */}
417
- <DatePicker mode="date" date={birthdate ? new Date(birthdate) : new Date()} onDateChange={_handleChangeDate} />
388
+ <TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
389
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ alignSelf: 'flex-start' }}>
390
+ {birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
391
+ </OText>
392
+ </TouchableOpacity>
393
+ {showDatePicker && (
394
+ <DatePickerUI birthdate={birthdate} handleChangeDate={_handleChangeDate} />
395
+ )}
418
396
  </WrapperPhone>
419
397
  )}
420
398
  {!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (