ordering-ui-react-native 0.17.9 → 0.17.11

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.9",
3
+ "version": "0.17.11",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -13,6 +13,7 @@ import { useTheme } from 'styled-components/native';
13
13
  import { useLocation } from '../../hooks/useLocation';
14
14
  import { FloatingButton } from '../FloatingButton';
15
15
  import { showLocation } from 'react-native-map-link';
16
+ import { transformDistance } from '../../utils';
16
17
 
17
18
  export const DriverMap = (props: GoogleMapsParams) => {
18
19
  const {
@@ -56,6 +57,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
56
57
  content: Array<string>;
57
58
  key?: string | null;
58
59
  }>({ open: false, content: [], key: null });
60
+ const distanceUnit = configState?.configs?.distance_unit?.value
59
61
 
60
62
  const {
61
63
  hasLocation,
@@ -475,9 +477,10 @@ export const DriverMap = (props: GoogleMapsParams) => {
475
477
  src={theme.images.general.arrow_distance}
476
478
  style={styles.arrowDistance}
477
479
  />
478
- <OText size={12} numberOfLines={3}>{`${(
479
- distancesFromTwoPlacesKm
480
- ).toFixed(2)} ${t('KM', 'KM')}`}</OText>
480
+ <OText size={12} numberOfLines={3}>
481
+ {`${transformDistance(distancesFromTwoPlacesKm, distanceUnit)} ${t(distanceUnit.toUpperCase(), distanceUnit)}`}
482
+ </OText>
483
+
481
484
  </View>
482
485
  <View style={{ width: '75%', paddingRight: 20 }}>
483
486
  <OText
@@ -345,3 +345,11 @@ export const getOrderStatus = (s: string, t: any) => {
345
345
 
346
346
  return objectStatus && objectStatus;
347
347
  };
348
+
349
+ export const transformDistance = (value : number, distanceUnit?: string) => {
350
+ return distanceUnit === 'mi'
351
+ ? (value / 1.609).toFixed(2)
352
+ : distanceUnit === 'ft'
353
+ ? (value * 3280.84).toFixed(0)
354
+ : (value).toFixed(2)
355
+ }
@@ -149,7 +149,7 @@ export const BusinessItemAccordion = (props: any) => {
149
149
  <OButton
150
150
  onClick={handleClickCheckout}
151
151
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
152
- style={{ width: 160, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
152
+ style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
153
153
  text={t('CHECKOUT', 'Checkout')}
154
154
  bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
155
155
  borderColor={theme.colors.primary}
@@ -97,7 +97,8 @@ export const ProfessionalFilter = (props: ProfessionalFilterParams) => {
97
97
  />
98
98
  ) : (
99
99
  <OIcon
100
- src={theme?.images?.dummies?.product}
100
+ src={theme?.images?.general?.user}
101
+ cover={false}
101
102
  style={styles.photoStyle}
102
103
  />
103
104
  )}
@@ -6,7 +6,7 @@ import CalendarPicker from 'react-native-calendar-picker'
6
6
  import FeatherIcon from 'react-native-vector-icons/Feather';
7
7
  import moment from 'moment'
8
8
  import SelectDropdown from 'react-native-select-dropdown'
9
- import { OButton, OText } from '../shared'
9
+ import { OButton, OText, OIcon } from '../shared'
10
10
  import IconAntDesign from 'react-native-vector-icons/AntDesign'
11
11
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
12
12
  import { ProfessionalProfileParams } from '../../types'
@@ -58,6 +58,9 @@ export const ProfessionalProfile = (props: ProfessionalProfileParams) => {
58
58
  height: 40,
59
59
  marginBottom: 30
60
60
  },
61
+ photoStyle: {
62
+ alignSelf: 'center'
63
+ }
61
64
  })
62
65
 
63
66
  const onDateChange = (date: any) => {
@@ -151,13 +154,21 @@ export const ProfessionalProfile = (props: ProfessionalProfileParams) => {
151
154
 
152
155
  return (
153
156
  <Container>
154
- <ProfessionalPhoto
155
- source={{
156
- uri:
157
- professional?.photo ||
158
- optimizeImage(theme.images.general.user, 'h_250,c_limit'),
159
- }}
160
- />
157
+ {!!professional?.photo ? (
158
+ <ProfessionalPhoto
159
+ source={{
160
+ uri: professional?.photo
161
+ }}
162
+ />
163
+ ) : (
164
+ <OIcon
165
+ src={theme.images.general.user}
166
+ style={styles.photoStyle}
167
+ cover={false}
168
+ width={200}
169
+ height={200}
170
+ />
171
+ )}
161
172
  <InfoWrapper>
162
173
  <OText
163
174
  size={20}
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect, useRef } from 'react'
2
2
  import { useTheme } from 'styled-components/native'
3
3
  import { Platform, View, StyleSheet, Dimensions, ScrollView, TouchableOpacity } from 'react-native'
4
- import { OText, OButton, OModal } from '../shared'
4
+ import { OText, OButton, OModal, OIcon } from '../shared'
5
5
  import FastImage from 'react-native-fast-image'
6
6
  import IconAntDesign from 'react-native-vector-icons/AntDesign'
7
7
  import SelectDropdown from 'react-native-select-dropdown'
@@ -241,13 +241,21 @@ const ServiceFormUI = (props: ServiceFormParams) => {
241
241
  return (
242
242
  <>
243
243
  <Container>
244
- <ProfessionalPhoto
245
- source={{
246
- uri:
247
- product?.images ||
248
- optimizeImage(theme?.images?.dummies?.product, 'h_250,c_limit'),
249
- }}
250
- />
244
+ {!!product?.images ? (
245
+ <ProfessionalPhoto
246
+ source={{
247
+ uri: product?.images
248
+ }}
249
+ />
250
+ ) : (
251
+ <OIcon
252
+ src={theme?.images?.dummies?.product}
253
+ cover={false}
254
+ style={{ alignSelf: 'center' }}
255
+ width={200}
256
+ height={200}
257
+ />
258
+ )}
251
259
  <InfoWrapper>
252
260
  <OText
253
261
  size={20}
@@ -301,14 +309,22 @@ const ServiceFormUI = (props: ServiceFormParams) => {
301
309
  onPress={() => setIsOpen(true)}
302
310
  >
303
311
  <View style={{ flexDirection: 'row' }}>
304
- <FastImage
305
- style={styles.photoStyle}
306
- source={{
307
- uri: optimizeImage(currentProfessional?.photo, 'h_250,c_limit'),
308
- priority: FastImage.priority.normal,
309
- }}
310
- resizeMode={FastImage.resizeMode.cover}
311
- />
312
+ {!!currentProfessional?.photo ? (
313
+ <FastImage
314
+ style={styles.photoStyle}
315
+ source={{
316
+ uri: optimizeImage(currentProfessional?.photo, 'h_250,c_limit'),
317
+ priority: FastImage.priority.normal,
318
+ }}
319
+ resizeMode={FastImage.resizeMode.cover}
320
+ />
321
+ ) : (
322
+ <OIcon
323
+ src={theme?.images?.general?.user}
324
+ cover={false}
325
+ style={styles.photoStyle}
326
+ />
327
+ )}
312
328
  <View style={{ marginLeft: 14 }}>
313
329
  <OText
314
330
  size={14}
@@ -532,14 +548,22 @@ const ServiceFormUI = (props: ServiceFormParams) => {
532
548
  onPress={() => handleChangeProfessional(professional)}
533
549
  >
534
550
  <View style={{ flexDirection: 'row' }}>
535
- <FastImage
536
- style={styles.photoStyle}
537
- source={{
538
- uri: optimizeImage(professional?.photo, 'h_250,c_limit'),
539
- priority: FastImage.priority.normal,
540
- }}
541
- resizeMode={FastImage.resizeMode.cover}
542
- />
551
+ {!!professional?.photo ? (
552
+ <FastImage
553
+ style={styles.photoStyle}
554
+ source={{
555
+ uri: optimizeImage(professional?.photo, 'h_250,c_limit'),
556
+ priority: FastImage.priority.normal,
557
+ }}
558
+ resizeMode={FastImage.resizeMode.cover}
559
+ />
560
+ ) : (
561
+ <OIcon
562
+ src={theme?.images?.general?.user}
563
+ cover={false}
564
+ style={styles.photoStyle}
565
+ />
566
+ )}
543
567
  <View style={{ marginLeft: 14 }}>
544
568
  <OText
545
569
  size={14}