Skip to content
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

Fix: BPKChip goes beyond its parent when the text is too long #2090

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

iHandle
Copy link
Contributor

@iHandle iHandle commented Oct 25, 2024

Changes

  • Use .lineLimit(1) instead of .fixedSize(horizontal: true, vertical: false) in ChipButtonStyle so that BPKChip will not go beyond its parent due to too long text.
  • Fix bug on BPKFlowStackView when computing Rows

Preview

Before After

Remember to include the following changes:

If you are curious about how we review, please read through the code review guidelines

@iHandle iHandle added the minor Non breaking change label Oct 25, 2024
@iHandle iHandle changed the title Fix: BPKChip goes beyond the screen when the text is too long Fix: BPKChip goes beyond its parent when the text is too long Oct 25, 2024
@@ -92,8 +92,10 @@ public struct BPKFlowStackView<Data: Collection, Content: View>: View where Data
let doesNotFitInCurrentRow = elementSize.width + spacing.width > remainingWidth

if doesNotFitInCurrentRow { // new row
remainingWidth = availableWidth
currentRow += 1
if rows.indices.contains(currentRow) {
Copy link
Contributor Author

@iHandle iHandle Oct 25, 2024

Choose a reason for hiding this comment

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

If this element is the only element in the current row, we do not need to +1 to currentRow

Copy link
Contributor

@alejandrorosas alejandrorosas left a comment

Choose a reason for hiding this comment

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

LGTM

@alejandrorosas alejandrorosas merged commit 5764cca into main Oct 25, 2024
15 checks passed
@alejandrorosas alejandrorosas deleted the LMN-1118-chip-goes-beyond-the-screen branch October 25, 2024 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Non breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants