ordering-ui-react-native 0.22.51-test1 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.22.51-test1",
3
+ "version": "0.22.52",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -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 ? marker?.customer?.location?.lat || 0 : marker?.business?.location?.lat || 0) ?? (initialPosition?.latitude || 0)
140
- let coordinateLng = (customer ? marker?.customer?.location?.lng || 0 : marker?.business?.location?.lng || 0) ?? (initialPosition?.longitude || 0)
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: customer ? marker?.customer?.location?.lat : marker?.business?.location?.lat,
161
- longitude: customer ? marker?.customer?.location?.lng : marker?.business?.location?.lng
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
- SoundPlayer.playUrl(URL_SOUND)
48
- await new Promise(resolve => setTimeout(resolve, DELAY_SOUND))
49
- SoundPlayer.stop()
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 solid ${(props: any) => props.theme.colors.lightGray};
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
- placeholderTextColor={theme.colors.arrowColor}
35
- numberOfLines={props.lines}
36
- underlineColorAndroid={'transparent'}
37
- value={props.value}
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
  );
@@ -29,7 +29,7 @@ import {
29
29
  TimeItem
30
30
  } from './styles';
31
31
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
32
- import { locale, monthsEnum, setLocalMoment } from '../../utils';
32
+ import { locale, monthsEnum } from '../../utils';
33
33
 
34
34
  const MomentOptionUI = (props: MomentOptionParams) => {
35
35
  const {
@@ -245,10 +245,6 @@ const MomentOptionUI = (props: MomentOptionParams) => {
245
245
  )
246
246
  }
247
247
 
248
- useEffect(() => {
249
- setLocalMoment(moment, t)
250
- }, [])
251
-
252
248
  useEffect(() => {
253
249
  if (datesList?.length > 0) {
254
250
  const _datesList = datesList.slice((cateringPreorder && preorderMinimumDays) || 0, Number(cateringPreorder ? preorderMaximumDays || configs?.max_days_preorder?.value : configs?.max_days_preorder?.value ?? 6))
@@ -131,7 +131,7 @@ export const monthsEnum: any = {
131
131
  }
132
132
 
133
133
  export const locale = {
134
- name: languageState?.language?.code?.slice(0, 2) || 'en',
134
+ name: languageState?.language?.code?.slice(0, 2),
135
135
  config: {
136
136
  months: [
137
137
  t('MONTH1', 'January'),