Skip to content

add ellipsizeMode prop for text truncation and improve accessibility #3542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 18, 2025

Conversation

adids1221
Copy link
Contributor

@adids1221 adids1221 commented Mar 2, 2025

Description

Avatar add ellipsizeMode prop for text truncation and improve accessibility handeling.
When using larger text on the device the label grow outside the container in some cases, we decided to remove the default ellipsizeMode and set it to clip.

Changelog

Avatar add ellipsizeMode prop for text truncation and improve accessibility handeling.

Additional info

MADS-4654

@adids1221 adids1221 marked this pull request as draft March 2, 2025 13:01
@adids1221 adids1221 marked this pull request as ready for review March 6, 2025 12:57
@adids1221 adids1221 requested a review from nitzanyiz March 6, 2025 12:58
@nitzanyiz
Copy link
Collaborator

@adids1221 The ticket in the additional info is not correct, can you fix it? 🙏

@adids1221
Copy link
Contributor Author

@adids1221 The ticket in the additional info is not correct, can you fix it? 🙏

fixed.

@adids1221 adids1221 assigned nitzanyiz and unassigned adids1221 Mar 11, 2025
@@ -185,6 +187,7 @@ const Avatar = forwardRef<any, AvatarProps>((props: AvatarProps, ref: React.Forw
useAutoColors,
autoColorsConfig,
containerStyle,
ellipsizeMode = 'clip',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the prop name should be more informative on where it goes. Perhaps is better:

Suggested change
ellipsizeMode = 'clip',
labelEllipsizeMode = 'clip',

@@ -354,7 +357,7 @@ const Avatar = forwardRef<any, AvatarProps>((props: AvatarProps, ref: React.Forw
>
<View testID={`${testID}.container`} style={textContainerStyle}>
{!_.isUndefined(text) && (
<Text numberOfLines={1} style={textStyle} testID={`${testID}.label`}>
<Text numberOfLines={1} ellipsizeMode={ellipsizeMode} style={textStyle} testID={`${testID}.label`}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Text numberOfLines={1} ellipsizeMode={ellipsizeMode} style={textStyle} testID={`${testID}.label`}>
<Text numberOfLines={1} ellipsizeMode={labelEllipsizeMode} style={textStyle} testID={`${testID}.label`}>

@nitzanyiz nitzanyiz assigned adids1221 and unassigned nitzanyiz Mar 12, 2025
@adids1221
Copy link
Contributor Author

Checked on Private with snapshot 7.39.0-snapshot.6546, works fine.

@adids1221 adids1221 requested a review from nitzanyiz March 18, 2025 09:24
@adids1221 adids1221 removed their assignment Mar 18, 2025
@nitzanyiz nitzanyiz merged commit 374918f into master Mar 18, 2025
1 check passed
@nitzanyiz nitzanyiz deleted the feat/Avatar_label_ellipsizeMode_support branch March 18, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants