ordering-ui-react-native 0.22.51 → 0.22.52
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
|
@@ -136,8 +136,20 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
136
136
|
const RenderMarker = ({ marker, customer, orderIds }: { marker: any, customer?: boolean, orderIds?: Array<number> }) => {
|
|
137
137
|
const markerRef = useRef<any>()
|
|
138
138
|
|
|
139
|
-
let coordinateLat = (customer
|
|
140
|
-
|
|
139
|
+
let coordinateLat = (customer
|
|
140
|
+
? typeof marker?.customer?.location?.lat === 'number' && !Number.isNaN(marker?.customer?.location?.lat)
|
|
141
|
+
? marker?.customer?.location?.lat
|
|
142
|
+
: 0
|
|
143
|
+
: typeof marker?.business?.location?.lat === 'number' && !Number.isNaN(marker?.business?.location?.lat)
|
|
144
|
+
? marker?.business?.location?.lat
|
|
145
|
+
: 0) ?? (initialPosition?.latitude || 0)
|
|
146
|
+
let coordinateLng = (customer
|
|
147
|
+
? typeof marker?.customer?.location?.lng === 'number' && !Number.isNaN(marker?.customer?.location?.lng)
|
|
148
|
+
? marker?.customer?.location?.lng
|
|
149
|
+
: 0
|
|
150
|
+
: typeof marker?.business?.location?.lng === 'number' && !Number.isNaN(marker?.business?.location?.lng)
|
|
151
|
+
? marker?.business?.location?.lng
|
|
152
|
+
: 0) ?? (initialPosition?.longitude || 0)
|
|
141
153
|
|
|
142
154
|
useEffect(() => {
|
|
143
155
|
if (
|
|
@@ -157,8 +169,8 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
157
169
|
}}
|
|
158
170
|
onPress={() =>
|
|
159
171
|
setLocationSelected({
|
|
160
|
-
latitude:
|
|
161
|
-
longitude:
|
|
172
|
+
latitude: coordinateLat,
|
|
173
|
+
longitude: coordinateLng
|
|
162
174
|
})
|
|
163
175
|
}
|
|
164
176
|
ref={(ref) => markerRef.current = ref}
|
|
@@ -240,8 +252,8 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
240
252
|
ref={mapRef}
|
|
241
253
|
provider={PROVIDER_GOOGLE}
|
|
242
254
|
initialRegion={{
|
|
243
|
-
latitude: initialPosition?.latitude,
|
|
244
|
-
longitude: initialPosition?.longitude,
|
|
255
|
+
latitude: initialPosition?.latitude || 0,
|
|
256
|
+
longitude: initialPosition?.longitude || 0,
|
|
245
257
|
latitudeDelta: haveOrders ? 0.01 : 0.1,
|
|
246
258
|
longitudeDelta: haveOrders ? 0.01 * ASPECT_RATIO : 0.1 * ASPECT_RATIO,
|
|
247
259
|
}}
|
|
@@ -271,8 +283,8 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
271
283
|
))}
|
|
272
284
|
<Marker
|
|
273
285
|
coordinate={{
|
|
274
|
-
latitude: location.lat,
|
|
275
|
-
longitude: location.lng,
|
|
286
|
+
latitude: typeof location.lat === 'number' && !Number.isNaN(location.lat) ? location.lat : 0,
|
|
287
|
+
longitude: typeof location.lng === 'number' && !Number.isNaN(location.lng) ? location.lng : 0,
|
|
276
288
|
}}
|
|
277
289
|
title={t('YOUR_LOCATION', 'Your Location')}
|
|
278
290
|
>
|
|
@@ -44,17 +44,25 @@ const SoundPlayerComponent = (props: any) => {
|
|
|
44
44
|
const id = setInterval(() => setCount(count + 1), 2500)
|
|
45
45
|
|
|
46
46
|
const playSound = async () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
try {
|
|
48
|
+
SoundPlayer.playUrl(URL_SOUND)
|
|
49
|
+
await new Promise(resolve => setTimeout(resolve, DELAY_SOUND))
|
|
50
|
+
SoundPlayer.stop()
|
|
51
|
+
} catch (err: any) {
|
|
52
|
+
console.log('Sound Error - ', err.message)
|
|
53
|
+
}
|
|
50
54
|
}
|
|
51
55
|
if (NativeModules?.RNSoundPlayer?.playUrl && typeof URL_SOUND === 'string' && isEnabledReadStorage) {
|
|
52
56
|
playSound()
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
return () => {
|
|
56
|
-
SoundPlayer.stop()
|
|
57
60
|
clearInterval(id);
|
|
61
|
+
try {
|
|
62
|
+
SoundPlayer.stop()
|
|
63
|
+
} catch (err: any) {
|
|
64
|
+
console.log('Sound Error - ', err.message)
|
|
65
|
+
}
|
|
58
66
|
}
|
|
59
67
|
}, [count, isEnabledReadStorage])
|
|
60
68
|
|
|
@@ -4,8 +4,10 @@ import { useTheme } from 'styled-components/native';
|
|
|
4
4
|
|
|
5
5
|
const Wrapper = styled.View`
|
|
6
6
|
border-radius: 10px;
|
|
7
|
-
border: 1px
|
|
7
|
+
border-width: 1px;
|
|
8
|
+
border-color: ${(props: any) => props.theme.colors.lightGray};
|
|
8
9
|
`;
|
|
10
|
+
|
|
9
11
|
const Inner = styled.TextInput`
|
|
10
12
|
height: 100px;
|
|
11
13
|
padding: 5px 10px 5px 10px;
|
|
@@ -29,16 +31,13 @@ const OTextarea = (props: Props) => {
|
|
|
29
31
|
ref={props.textTareaRef}
|
|
30
32
|
onFocus={() => props.onFocus()}
|
|
31
33
|
onChangeText={(txt: any) => props.onChange(txt)}
|
|
32
|
-
textAlignVertical={'top'}
|
|
33
34
|
placeholder={props.placeholder}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
placeholderTextColor={theme.colors.lightGray}
|
|
36
|
+
numberOfLines={props.lines}
|
|
37
|
+
underlineColorAndroid={'transparent'}
|
|
38
|
+
value={props.value}
|
|
39
|
+
multiline={true}
|
|
38
40
|
autoFocus={props.autoFocus}
|
|
39
|
-
multiline={true}
|
|
40
|
-
selectionColor={theme.colors.primary}
|
|
41
|
-
color={theme.colors.textGray}
|
|
42
41
|
/>
|
|
43
42
|
</Wrapper>
|
|
44
43
|
);
|