ordering-ui-react-native 0.23.4 → 0.23.5
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
|
@@ -16,6 +16,8 @@ import { ListItem } from '../UserProfile/styles';
|
|
|
16
16
|
import moment from 'moment';
|
|
17
17
|
import { DatePickerUI } from '../DatePicker';
|
|
18
18
|
|
|
19
|
+
const CONDITIONAL_CODES = ['PR']
|
|
20
|
+
|
|
19
21
|
export const UserFormDetailsUI = (props: any) => {
|
|
20
22
|
const {
|
|
21
23
|
isEdit,
|
|
@@ -129,6 +131,16 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
129
131
|
return rules;
|
|
130
132
|
};
|
|
131
133
|
|
|
134
|
+
const cellphoneValue = () => {
|
|
135
|
+
let cellphone = user?.cellphone || null
|
|
136
|
+
if (cellphone && CONDITIONAL_CODES.includes(user?.country_code)) {
|
|
137
|
+
if (user?.country_code === 'PR') {
|
|
138
|
+
cellphone = user?.cellphone?.slice(3)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return cellphone
|
|
142
|
+
}
|
|
143
|
+
|
|
132
144
|
const setUserCellPhone = (isEdit = false) => {
|
|
133
145
|
if (userPhoneNumber && !userPhoneNumber.includes('null') && !isEdit) {
|
|
134
146
|
setUserPhoneNumber(userPhoneNumber);
|
|
@@ -146,7 +158,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
146
158
|
...phoneInputData,
|
|
147
159
|
phone: {
|
|
148
160
|
country_phone_code: user?.country_phone_code || null,
|
|
149
|
-
cellphone:
|
|
161
|
+
cellphone: cellphoneValue()
|
|
150
162
|
},
|
|
151
163
|
});
|
|
152
164
|
return;
|
|
@@ -405,7 +417,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
405
417
|
data={phoneInputData}
|
|
406
418
|
handleData={(val: any) => handleChangePhoneNumber(val)}
|
|
407
419
|
changeCountry={(val: any) => changeCountry(val)}
|
|
408
|
-
defaultValue={phoneUpdate ? '' :
|
|
420
|
+
defaultValue={phoneUpdate ? '' : cellphoneValue()}
|
|
409
421
|
defaultCode={user?.country_code ?? user?.country_phone_code ?? null}
|
|
410
422
|
boxStyle={styles.phoneSelect}
|
|
411
423
|
inputStyle={styles.phoneInputStyle}
|
|
@@ -418,7 +430,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
418
430
|
color={theme.colors.error}
|
|
419
431
|
style={{ marginHorizontal: 10, textAlign: 'center' }}>
|
|
420
432
|
{t('YOUR_PREVIOUS_CELLPHONE', 'Your previous cellphone')}:{' '}
|
|
421
|
-
{
|
|
433
|
+
{cellphoneValue()}
|
|
422
434
|
</OText>
|
|
423
435
|
)}
|
|
424
436
|
</WrapperPhone>
|