ordering-ui-react-native 0.22.30 → 0.22.32

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.30",
3
+ "version": "0.22.32",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -165,14 +165,16 @@ const MapViewComponent = (props: MapViewParams) => {
165
165
  size={50}
166
166
  color={theme.colors.primary}
167
167
  />
168
- <View style={styles.view}>
169
- <OIcon
170
- style={styles.image}
171
- src={{ uri: customer ? marker?.customer?.photo : marker?.business?.logo }}
172
- width={25}
173
- height={25}
174
- />
175
- </View>
168
+ {(!!marker?.customer?.photo || !!marker?.business?.logo) && (
169
+ <View style={styles.view}>
170
+ <OIcon
171
+ style={styles.image}
172
+ src={{ uri: customer ? marker?.customer?.photo : marker?.business?.logo }}
173
+ width={25}
174
+ height={25}
175
+ />
176
+ </View>
177
+ )}
176
178
  <Callout
177
179
  onPress={() => !!orderIds && orderIds.toString().includes(',') ? onNavigationRedirect('Orders') : onNavigationRedirect('OrderDetails', { order: marker })}
178
180
  >
@@ -193,8 +195,8 @@ const MapViewComponent = (props: MapViewParams) => {
193
195
  {((customer && marker?.customer?.city?.address_notes) || !customer) && (
194
196
  <OText>{customer ? marker?.customer?.city?.address_notes : marker?.business?.city?.name}</OText>
195
197
  )}
196
- {((customer && marker?.business?.zipcode) || (!customer && marker?.business?.zipcode)) && (
197
- <OText>{customer ? marker?.customer?.zipcode : marker?.business?.zipcode}</OText>
198
+ {((customer && !!marker?.business?.zipcode) || (!customer && !!marker?.business?.zipcode)) && (
199
+ <OText>{customer ? marker?.customer?.zipcode ?? '' : marker?.business?.zipcode ?? ''}</OText>
198
200
  )}
199
201
  {customer && !!marker?.customer?.internal_number && (
200
202
  <OText>{marker?.customer?.internal_number}</OText>
@@ -6,7 +6,7 @@ import { useTheme } from 'styled-components/native';
6
6
  import { Wrapper } from './styles';
7
7
  import { OText, OIcon } from '../shared';
8
8
  import { PhoneInputParams } from '../../types';
9
- import { transformCountryCode } from '../../utils';
9
+ import { transformCountryCode, findExitingCode } from '../../utils';
10
10
 
11
11
  export const PhoneInputNumber = (props: PhoneInputParams) => {
12
12
  const {
@@ -97,10 +97,13 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
97
97
  containerStyle={{ width: '100%' }}
98
98
  ref={phoneInput}
99
99
  defaultValue={userphoneNumber || defaultValue}
100
- defaultCode={
101
- defaultCode
102
- ? transformCountryCode(defaultCode)
103
- : configs?.default_country_code?.value
100
+ defaultCode={defaultCode ?
101
+ !isNaN(defaultCode)
102
+ ? transformCountryCode(defaultCode)
103
+ : findExitingCode(defaultCode)
104
+ : !isNaN((configs?.default_country_code?.value || '')?.replace(/\+/g, ''))
105
+ ? transformCountryCode((configs?.default_country_code?.value || '')?.replace(/\+/g, ''))
106
+ : findExitingCode(configs?.default_country_code?.value?.toUpperCase())
104
107
  }
105
108
  onChangeFormattedText={(text: string) => handleChangeNumber(text)}
106
109
  countryPickerProps={{
@@ -146,6 +146,11 @@ export const transformCountryCode = (countryCode: number) => {
146
146
  return code?.countryCode;
147
147
  };
148
148
 
149
+ export const findExitingCode = (countryCode: string) => {
150
+ const code = CODES.find((code: any) => code.countryCode === (countryCode || '').toUpperCase())
151
+ return code?.countryCode
152
+ }
153
+
149
154
  /**
150
155
  * Function to check if a number is decimal or not
151
156
  * @param {*} value number to check if decimal or not