ordering-ui-react-native 0.16.12 → 0.16.13
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 +2 -1
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +9 -26
- package/themes/original/src/components/BusinessesListing/index.tsx +21 -10
- package/themes/original/src/components/GPSButton/index.tsx +15 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-react-native",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.13",
|
|
4
4
|
"description": "Reusable components made in react native",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"author": "ordering.inc",
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
"react-native-sound": "^0.11.1",
|
|
110
110
|
"react-native-swipe-gestures": "^1.0.5",
|
|
111
111
|
"react-native-swiper": "^1.6.0",
|
|
112
|
+
"react-native-tracking-transparency": "^0.1.1",
|
|
112
113
|
"react-native-uuid": "^2.0.1",
|
|
113
114
|
"react-native-vector-icons": "^7.1.0",
|
|
114
115
|
"react-native-webview": "^11.6.4",
|
|
@@ -327,6 +327,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
327
327
|
justifyContent: 'center',
|
|
328
328
|
paddingVertical: 10,
|
|
329
329
|
paddingHorizontal: 80,
|
|
330
|
+
position: 'absolute'
|
|
330
331
|
},
|
|
331
332
|
showButton: {
|
|
332
333
|
alignSelf: 'center',
|
|
@@ -490,14 +491,14 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
490
491
|
</View>
|
|
491
492
|
</View>
|
|
492
493
|
</View>
|
|
493
|
-
<View style={
|
|
494
|
+
<View style={{
|
|
495
|
+
...styles.buttonContainer,
|
|
496
|
+
bottom: showAcceptOrReject ? 80 : 0
|
|
497
|
+
}}>
|
|
494
498
|
<OButton
|
|
495
499
|
imgRightSrc=''
|
|
496
500
|
textStyle={{ color: theme.colors.white }}
|
|
497
|
-
style={
|
|
498
|
-
...styles.showButton,
|
|
499
|
-
bottom: showAcceptOrReject ? 80 : 0
|
|
500
|
-
}}
|
|
501
|
+
style={styles.showButton}
|
|
501
502
|
onClick={() => showLocation({
|
|
502
503
|
latitude: destination.latitude,
|
|
503
504
|
longitude: destination.longitude,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { OModal, OText, OIcon } from '../../shared'
|
|
3
|
+
import { ScrollView } from 'react-native'
|
|
4
|
+
import { useUtils } from 'ordering-components/native'
|
|
5
|
+
|
|
6
|
+
interface CategoryDescriptionParams {
|
|
7
|
+
openDescription?: {name: string, image: string, description: string} | null,
|
|
8
|
+
setOpenDescription: any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function categoryDescriptionPropsAreEqual(prev : any, next : any) {
|
|
12
|
+
return prev.openDescription === next.openDescription
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const CategoryDescription = (props : CategoryDescriptionParams) => {
|
|
16
|
+
const [{ optimizeImage }] = useUtils()
|
|
17
|
+
return (
|
|
18
|
+
<OModal
|
|
19
|
+
open={!!props.openDescription}
|
|
20
|
+
onClose={() => props.setOpenDescription(null)}
|
|
21
|
+
styleContainerCloseButton={{
|
|
22
|
+
marginLeft: -30,
|
|
23
|
+
width: 55,
|
|
24
|
+
height: 55,
|
|
25
|
+
marginTop: 2
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<OText size={20} style={{ paddingLeft: 70, paddingRight: 20, bottom: 25 }}>{props.openDescription?.name}</OText>
|
|
29
|
+
<ScrollView style={{ padding: 20 }}>
|
|
30
|
+
{!!props.openDescription?.image && (
|
|
31
|
+
<OIcon
|
|
32
|
+
url={optimizeImage(props.openDescription?.image, 'h_100,c_limit')}
|
|
33
|
+
width={240}
|
|
34
|
+
height={240}
|
|
35
|
+
style={{ borderRadius: 7.6 }}
|
|
36
|
+
/>
|
|
37
|
+
)}
|
|
38
|
+
<OText mBottom={60}>{props.openDescription?.description}</OText>
|
|
39
|
+
</ScrollView>
|
|
40
|
+
</OModal>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const CategoryDescriptionMemoized = React.memo(CategoryDescription,categoryDescriptionPropsAreEqual)
|
|
@@ -10,6 +10,7 @@ import { View, ScrollView } from 'react-native';
|
|
|
10
10
|
import { StyleSheet } from 'react-native';
|
|
11
11
|
import { useTheme } from 'styled-components/native';
|
|
12
12
|
import { shape } from '../../utils'
|
|
13
|
+
import { CategoryDescriptionMemoized } from './CategoryDescription';
|
|
13
14
|
|
|
14
15
|
const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
15
16
|
const {
|
|
@@ -33,8 +34,8 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
33
34
|
subcategoriesSelected,
|
|
34
35
|
onClickCategory,
|
|
35
36
|
lazyLoadProductsRecommended,
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
handleUpdateProducts,
|
|
38
|
+
isFiltMode
|
|
38
39
|
} = props;
|
|
39
40
|
|
|
40
41
|
const [, t] = useLanguage();
|
|
@@ -104,7 +105,6 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
104
105
|
)
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
|
|
108
108
|
return (
|
|
109
109
|
<ProductsContainer renderToHardwareTextureAndroid={categoryState.loading || isBusinessLoading}>
|
|
110
110
|
<HeaderWrapper>
|
|
@@ -317,29 +317,12 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
317
317
|
<OText>{e}</OText>
|
|
318
318
|
</ErrorMessage>
|
|
319
319
|
))}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
height: 55,
|
|
327
|
-
marginTop: 2
|
|
328
|
-
}}
|
|
329
|
-
>
|
|
330
|
-
<OText size={20} style={{ paddingLeft: 70, paddingRight: 20, bottom: 25 }}>{openDescription?.name}</OText>
|
|
331
|
-
<ScrollView style={{ padding: 20 }}>
|
|
332
|
-
{!!openDescription?.image && (
|
|
333
|
-
<OIcon
|
|
334
|
-
url={optimizeImage(openDescription?.image, 'h_100,c_limit')}
|
|
335
|
-
width={240}
|
|
336
|
-
height={240}
|
|
337
|
-
style={{ borderRadius: 7.6 }}
|
|
338
|
-
/>
|
|
339
|
-
)}
|
|
340
|
-
<OText mBottom={60}>{openDescription?.description}</OText>
|
|
341
|
-
</ScrollView>
|
|
342
|
-
</OModal>
|
|
320
|
+
{!!openDescription && (
|
|
321
|
+
<CategoryDescriptionMemoized
|
|
322
|
+
openDescription={openDescription}
|
|
323
|
+
setOpenDescription={setOpenDescription}
|
|
324
|
+
/>
|
|
325
|
+
)}
|
|
343
326
|
</ProductsContainer>
|
|
344
327
|
);
|
|
345
328
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
3
3
|
import Geolocation from '@react-native-community/geolocation'
|
|
4
|
+
import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
|
|
4
5
|
import {
|
|
5
6
|
View,
|
|
6
7
|
StyleSheet,
|
|
@@ -194,17 +195,27 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
|
|
198
|
+
const checkUserLocation = async () => {
|
|
199
|
+
let trackingStatus = await getTrackingStatus()
|
|
200
|
+
if (trackingStatus === 'not-determined') {
|
|
201
|
+
trackingStatus = await requestTrackingPermission()
|
|
202
|
+
}
|
|
203
|
+
if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
|
|
204
|
+
Geolocation.getCurrentPosition((pos) => {
|
|
205
|
+
const crd = pos.coords
|
|
206
|
+
const distance = getDistance(crd.latitude, crd.longitude, orderState?.options?.address?.location?.lat, orderState?.options?.address?.location?.lng)
|
|
207
|
+
if (distance > 20) setIsFarAway(true)
|
|
208
|
+
else setIsFarAway(false)
|
|
209
|
+
}, (err) => {
|
|
210
|
+
console.log(`ERROR(${err.code}): ${err.message}`)
|
|
211
|
+
}, {
|
|
212
|
+
enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
197
217
|
useEffect(() => {
|
|
198
|
-
|
|
199
|
-
const crd = pos.coords
|
|
200
|
-
const distance = getDistance(crd.latitude, crd.longitude, orderState?.options?.address?.location?.lat, orderState?.options?.address?.location?.lng)
|
|
201
|
-
if (distance > 20) setIsFarAway(true)
|
|
202
|
-
else setIsFarAway(false)
|
|
203
|
-
}, (err) => {
|
|
204
|
-
console.log(`ERROR(${err.code}): ${err.message}`)
|
|
205
|
-
}, {
|
|
206
|
-
enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
|
|
207
|
-
})
|
|
218
|
+
checkUserLocation()
|
|
208
219
|
}, [orderState?.options?.address?.location])
|
|
209
220
|
|
|
210
221
|
useEffect(() => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
|
|
2
3
|
import Geolocation from '@react-native-community/geolocation'
|
|
3
4
|
import Geocoder from 'react-native-geocoding'
|
|
4
5
|
import { GpsButtonStyle } from './styles'
|
|
@@ -55,14 +56,20 @@ export const GPSButton = (props: any) => {
|
|
|
55
56
|
})
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
const getCurrentPosition = () => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
const getCurrentPosition = async () => {
|
|
60
|
+
let trackingStatus = await getTrackingStatus()
|
|
61
|
+
if (trackingStatus === 'not-determined') {
|
|
62
|
+
trackingStatus = await requestTrackingPermission()
|
|
63
|
+
}
|
|
64
|
+
if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
|
|
65
|
+
setLoading(true);
|
|
66
|
+
Geolocation.getCurrentPosition((pos) => {
|
|
67
|
+
geoCodePosition(pos.coords);
|
|
68
|
+
}, (err) => {
|
|
69
|
+
setLoading(false);
|
|
70
|
+
console.log(err);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
66
73
|
}
|
|
67
74
|
|
|
68
75
|
useEffect(() => {
|