-
Notifications
You must be signed in to change notification settings - Fork 0
feat: allow text truncation with ellipsis #155
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
Conversation
Summary of ChangesHello @MinCrohn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a valuable text overflow feature, allowing for text truncation with hidden and ellipsis options. The implementation is solid, with a new overflow property in the TextStyle schema and an efficient binary search algorithm for truncation. The addition of comprehensive tests for the new functionality is also a great contribution.
I've made one suggestion in src/display/mixins/Textstyleable.js to refactor a small piece of duplicated logic for improved code clarity and maintainability.
Overall, this is a well-executed feature enhancement.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a valuable text overflow feature with ellipsis and hidden options. The implementation is well-done, particularly the efficient binary search algorithm for truncation and the careful state management to restore the full text when needed. The code is clean, and the refactoring to move splitText to a shared utility and modernize hasOwnProperty checks are good improvements. The addition of a comprehensive test suite for the new functionality is excellent and ensures its robustness. I have one suggestion regarding a linter configuration change, but overall, this is a high-quality contribution.
💡 Summary
Added the
overflowstyle property to the Text component to control how text is displayed when it exceeds its content area.You can now prevent text from breaking the layout by clipping it (
hidden) or adding an ellipsis (...).✨ Key Changes
Previously, text that was longer than its container would always overflow and remain visible (
visible), which could disrupt the layout.This update introduces the
overflowoption in thestyleproperty, allowing you to control this behavior.The supported modes are:
visible(default): Text flows outside the bounds, same as the existing behavior.hidden: Text exceeding the bounds is clipped and hidden.ellipsis: Text exceeding the bounds is truncated and replaced with....📖 How to Use
Set the
overflowkey within thestyleproperty of theTextcomponent.1. Ellipsis
Truncates long text with
...to maintain the layout while indicating there is more text.2. Clipping Text (Hidden)
Simply hides any text that exceeds the bounds.
3. Dynamic Update
You can dynamically change the
overflowproperty using theupdate()method. It automatically recalculates when the container'ssizeormarginchanges.✅ Notes
fontSize: 'auto'. IfautoFontis configured, the library will first attempt to shrink the font size to fit the container. Theoverflowlogic is applied only if the text still overflows after reaching the minimum font size (min).