react-native-ui-lib 8.2.0 → 8.2.1
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
|
@@ -78,7 +78,6 @@ const TextField = props => {
|
|
|
78
78
|
readonly = false,
|
|
79
79
|
showMandatoryIndication,
|
|
80
80
|
clearButtonStyle,
|
|
81
|
-
accessibilityLabel: accessibilityLabelProp,
|
|
82
81
|
...others
|
|
83
82
|
} = usePreset(props);
|
|
84
83
|
const {
|
|
@@ -136,28 +135,8 @@ const TextField = props => {
|
|
|
136
135
|
const hasValue = fieldState.value !== undefined; // NOTE: not pressable if centered without a value (so can't center placeholder)
|
|
137
136
|
const inputStyle = useMemo(() => [typographyStyle, colorStyle, others.style, hasValue && centeredTextStyle], [typographyStyle, colorStyle, others.style, centeredTextStyle, hasValue]);
|
|
138
137
|
const dummyPlaceholderStyle = useMemo(() => [inputStyle, styles.dummyPlaceholder], [inputStyle]);
|
|
139
|
-
const defaultAccessibilityLabel = useMemo(() => {
|
|
140
|
-
const parts = [];
|
|
141
|
-
if (label) {
|
|
142
|
-
parts.push(label);
|
|
143
|
-
}
|
|
144
|
-
if (context.isMandatory) {
|
|
145
|
-
parts.push('required');
|
|
146
|
-
}
|
|
147
|
-
parts.push('textField');
|
|
148
|
-
if (helperText) {
|
|
149
|
-
parts.push(helperText);
|
|
150
|
-
} else if (placeholder) {
|
|
151
|
-
parts.push(placeholder);
|
|
152
|
-
}
|
|
153
|
-
if (showCharCounter && others.maxLength) {
|
|
154
|
-
parts.push(`you can enter up to ${others.maxLength} characters`);
|
|
155
|
-
}
|
|
156
|
-
return parts.join(', ');
|
|
157
|
-
}, [label, context.isMandatory, helperText, placeholder, showCharCounter, others.maxLength]);
|
|
158
|
-
const accessibilityLabel = accessibilityLabelProp ?? defaultAccessibilityLabel;
|
|
159
138
|
return <FieldContext.Provider value={context}>
|
|
160
|
-
<View {...containerProps}
|
|
139
|
+
<View {...containerProps} style={[margins, positionStyle, containerStyle, centeredContainerStyle]}>
|
|
161
140
|
<View row spread style={centeredContainerStyle}>
|
|
162
141
|
<Label label={label} labelColor={labelColor} labelStyle={_labelStyle} labelProps={labelProps} floatingPlaceholder={floatingPlaceholder} validationMessagePosition={validationMessagePosition} testID={`${props.testID}.label`} showMandatoryIndication={showMandatoryIndication} enableErrors={enableErrors} />
|
|
163
142
|
{validationMessagePosition === ValidationMessagePosition.TOP && <ValidationMessage enableErrors={enableErrors} validate={others.validate} validationMessage={others.validationMessage} validationMessageStyle={_validationMessageStyle} retainValidationSpace={retainValidationSpace && retainTopMessageSpace} testID={`${props.testID}.validationMessage`} />}
|