ordering-ui-react-native 0.17.10 → 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.10",
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}