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
|
@@ -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
|