ordering-ui-react-native 0.18.58-test2 → 0.18.58-test4
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
|
@@ -3,7 +3,7 @@ import Geocoder from 'react-native-geocoding'
|
|
|
3
3
|
import { ActivityIndicator } from 'react-native-paper'
|
|
4
4
|
import Geolocation from '@react-native-community/geolocation'
|
|
5
5
|
import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
|
|
6
|
-
import { Platform } from 'react-native'
|
|
6
|
+
import { Platform, PermissionsAndroid } from 'react-native'
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
PERMISSIONS,
|
|
@@ -79,11 +79,7 @@ export const GPSButton = (props: any) => {
|
|
|
79
79
|
if (trackingStatus === 'not-determined') {
|
|
80
80
|
trackingStatus = await requestTrackingPermission()
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
...errorState,
|
|
84
|
-
trackingStatus: trackingStatus
|
|
85
|
-
})
|
|
86
|
-
if (trackingStatus === 'authorized') {
|
|
82
|
+
if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
|
|
87
83
|
setLoading(true)
|
|
88
84
|
Geolocation.getCurrentPosition((pos) => {
|
|
89
85
|
setErrorState({
|
|
@@ -99,44 +95,64 @@ export const GPSButton = (props: any) => {
|
|
|
99
95
|
setLoading(false);
|
|
100
96
|
console.log(`ERROR(${err.code}): ${err.message}`)
|
|
101
97
|
}, {
|
|
102
|
-
enableHighAccuracy:
|
|
98
|
+
enableHighAccuracy: false, timeout: 30000, maximumAge: 1000
|
|
103
99
|
})
|
|
104
|
-
return
|
|
105
100
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
Geolocation.getCurrentPosition((pos) => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}, (err) => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}, {
|
|
132
|
-
|
|
133
|
-
})
|
|
101
|
+
|
|
102
|
+
// let permissionStatus: PermissionStatus;
|
|
103
|
+
// setLoading(true)
|
|
104
|
+
// if (Platform.OS === 'ios') {
|
|
105
|
+
// permissionStatus = await request(PERMISSIONS.IOS.LOCATION_WHEN_IN_USE);
|
|
106
|
+
// } else {
|
|
107
|
+
// // permissionStatus = await request(
|
|
108
|
+
// // PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION,
|
|
109
|
+
// // );
|
|
110
|
+
// const result = requestLocationPermission();
|
|
111
|
+
// result.then(res => {
|
|
112
|
+
// if (res) {
|
|
113
|
+
// Geolocation.getCurrentPosition((pos) => {
|
|
114
|
+
// setErrorState({
|
|
115
|
+
// ...errorState,
|
|
116
|
+
// getCurrentPositionNew2: pos
|
|
117
|
+
// })
|
|
118
|
+
// geoCodePosition(pos.coords)
|
|
119
|
+
// }, (err) => {
|
|
120
|
+
// setErrorState({
|
|
121
|
+
// ...errorState,
|
|
122
|
+
// fallbackGetCurrentPositionNew2: err
|
|
123
|
+
// })
|
|
124
|
+
// setLoading(false);
|
|
125
|
+
// console.log(`ERROR(${err.code}): ${err.message}`)
|
|
126
|
+
// }, {
|
|
127
|
+
// enableHighAccuracy: true, timeout: 30000, maximumAge: 10000
|
|
128
|
+
// })
|
|
129
|
+
// }
|
|
130
|
+
// }); }
|
|
131
|
+
// if (permissionStatus === 'denied') {
|
|
132
|
+
// openSettings();
|
|
133
|
+
// }
|
|
134
|
+
// Geolocation.getCurrentPosition((pos) => {
|
|
135
|
+
// setErrorState({
|
|
136
|
+
// ...errorState,
|
|
137
|
+
// getCurrentPositionNew: pos
|
|
138
|
+
// })
|
|
139
|
+
// geoCodePosition(pos.coords)
|
|
140
|
+
// }, (err) => {
|
|
141
|
+
// setErrorState({
|
|
142
|
+
// ...errorState,
|
|
143
|
+
// fallbackGetCurrentPositionNew: err
|
|
144
|
+
// })
|
|
145
|
+
// setLoading(false);
|
|
146
|
+
// console.log(`ERROR(${err.code}): ${err.message}`)
|
|
147
|
+
// }, {
|
|
148
|
+
// enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
|
|
149
|
+
// })
|
|
134
150
|
}
|
|
135
151
|
|
|
136
152
|
useEffect(() => {
|
|
137
153
|
if (isIntGeoCoder) return
|
|
138
154
|
Geocoder.init(apiKey);
|
|
139
|
-
}, [
|
|
155
|
+
}, [])
|
|
140
156
|
|
|
141
157
|
return (
|
|
142
158
|
<GpsButtonStyle
|