ordering-ui-react-native 0.18.30 → 0.18.31

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.18.30",
3
+ "version": "0.18.31",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -7,7 +7,7 @@ import { Wrapper } from './styles'
7
7
 
8
8
  import { PhoneInputParams } from '../../types';
9
9
  import { OIcon, OText } from '../shared';
10
- import { transformCountryCode } from '../../utils'
10
+ import { findExitingCode, transformCountryCode } from '../../utils'
11
11
 
12
12
  export const PhoneInputNumber = (props: PhoneInputParams) => {
13
13
  const {
@@ -113,7 +113,7 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
113
113
  !isNaN(defaultCode)
114
114
  ? transformCountryCode(defaultCode)
115
115
  : defaultCode
116
- : configs?.default_country_code?.value?.toUpperCase()}
116
+ : findExitingCode(configs?.default_country_code?.value?.toUpperCase())}
117
117
  onChangeFormattedText={(text: string) => handleChangeNumber(text)}
118
118
  withDarkTheme
119
119
  onChangeCountry={(country) => changeCountry?.(country)}
@@ -271,6 +271,11 @@ export const transformCountryCode = (countryCode: number) => {
271
271
  return code?.countryCode
272
272
  }
273
273
 
274
+ export const findExitingCode = (countryCode: string) => {
275
+ const code = CODES.find((code: any) => code.countryCode === countryCode)
276
+ return code?.countryCode
277
+ }
278
+
274
279
  /**
275
280
  * Function to check if a number is decimal or not
276
281
  * @param {*} value number to check if decimal or not