@fto-consult/expo-ui 8.82.3 → 8.82.4

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": "@fto-consult/expo-ui",
3
- "version": "8.82.3",
3
+ "version": "8.82.4",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "react-native-paper-doc": "https://github.com/callstack/react-native-paper/tree/main/docs/docs/guides",
6
6
  "scripts": {
@@ -161,7 +161,7 @@ export default function PhoneInputComponent(props){
161
161
  }}
162
162
  testID = {testID}
163
163
  error = {error}
164
- errorText = {errorText}
164
+ errorText = {state.errorText || errorText}
165
165
  helperText = {helperText}
166
166
  contentContainerProps = {contentContainerProps}
167
167
  label = {label}
@@ -187,19 +187,18 @@ export default function PhoneInputComponent(props){
187
187
  const {value:nValue} = args;
188
188
  const prevState = state;
189
189
  const nState = updateValue(nValue);
190
+ let value = defaultStr(nState.defaultValue).trim();
191
+ if(value =="+" || value =="("){
192
+ value = "";
193
+ }
194
+ const prevVal = defaultStr(prevState.defaultValue).trim();
195
+ if(prevVal.ltrim(dialCodePrefix) === value.ltrim(dialCodePrefix)) return;
196
+ const canChange = value.length < 5 || PhoneNumber.parse(nState.displayValue,nState.countryCode);
197
+ nState.errorText = canChange ? undefined : "Veuillez entrer un numéro de téléphone valide";
190
198
  setState({...state,...nState});
191
199
  const dialCodePrefix = getDialCodePrefix(prevState.countryDialCode) || getDialCodePrefix(state.countryDialCode);
192
- if(onChange){
193
- let value = defaultStr(nState.defaultValue).trim();
194
- if(value =="+" || value =="("){
195
- value = "";
196
- }
197
- const prevVal = defaultStr(prevState.defaultValue).trim();
198
- if(prevVal.ltrim(dialCodePrefix) === value.ltrim(dialCodePrefix)) return;
199
- const canChange = value.length < 5 || PhoneNumber.parse(nState.displayValue,nState.countryCode);
200
- if(canChange) {
201
- onChange({...nState,value,country:nState.country,displayValue:nState.displayValue,realValue:nState.defaultValue})
202
- }
200
+ if(onChange && canChange){
201
+ onChange({...nState,value,country:nState.country,displayValue:nState.displayValue,realValue:nState.defaultValue});
203
202
  }
204
203
  }}
205
204
  ref = {ref}