Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ npmRegistryServer: "https://registry.npmjs.org/"
npmMinimalAgeGate: "14d"
npmPreapprovedPackages: ["@wix/*"]

yarnPath: .yarn/releases/yarn-4.12.0.cjs
yarnPath: .yarn/releases/yarn-4.12.0.cjs
Comment thread
yotam-wix marked this conversation as resolved.
Outdated
28 changes: 27 additions & 1 deletion packages/react-native-ui-lib/src/components/textField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,35 @@ const TextField = (props: InternalTextFieldProps) => {
[typographyStyle, colorStyle, others.style, centeredTextStyle, hasValue]);
const dummyPlaceholderStyle = useMemo(() => [inputStyle, styles.dummyPlaceholder], [inputStyle]);

const accessibilityLabel = useMemo(() => {
const parts: string[] = [];

if (label) {
parts.push(label);
}

if (context.isMandatory) {
parts.push('required');
}

parts.push('textField');

if (helperText) {
parts.push(helperText);
} else if (placeholder) {
parts.push(placeholder);
}
Comment thread
lidord-wix marked this conversation as resolved.

if (showCharCounter && others.maxLength) {
parts.push(`you can enter up to ${others.maxLength} characters`);
}

return parts.join(', ');
Comment thread
lidord-wix marked this conversation as resolved.
}, [label, context.isMandatory, helperText, placeholder, showCharCounter, others.maxLength]);

return (
<FieldContext.Provider value={context}>
<View {...containerProps} style={[margins, positionStyle, containerStyle, centeredContainerStyle]}>
<View {...containerProps} accessible accessibilityLabel={accessibilityLabel} style={[margins, positionStyle, containerStyle, centeredContainerStyle]}>
<View row spread style={centeredContainerStyle}>
<Label
label={label}
Expand Down