Commit ad0f41c
authored
fix(predict): allows long titles to wrap in buy preview header (#28446)
## **Description**
The Predict buy preview screen header did not constrain the title area
width, causing long market titles (e.g. "Tottenham Hotspur FC vs.
Brighton & Hove Albion") to overflow the screen. The outer title `Box`
was missing `flex-1 min-w-0`, so it ignored the parent row's bounds.
Fixed by adding flex constraints to the title container and switching
from single-line truncation to text wrapping for both the market title
and subtitle row, so the full market name is always visible.
## **Changelog**
CHANGELOG entry: Fixed long titles overflowing on the Predict buy
preview header
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/PRED-799
## **Manual testing steps**
```gherkin
Feature: Predict buy preview header text wrapping
Scenario: long market title wraps within the header
Given the user is on the Predict feed
And a market with a long title is visible (e.g. "Tottenham Hotspur FC vs. Brighton & Hove Albion")
When the user taps a buy button to open the buy preview screen
Then the full market title wraps onto multiple lines within the header
And the title does not overflow or clip beyond the screen edge
And the back button remains visible and tappable on the left
Scenario: subtitle row wraps when content is long
Given the user opens the buy preview for a market with a long group item title and outcome label
When the header renders
Then the subtitle text wraps to a new line if it exceeds the available width
And the separator dot remains between the group title and outcome label
Scenario: short market title displays on a single line
Given the user opens the buy preview for a market with a short title (e.g. "Will BTC hit $100k?")
When the header renders
Then the title displays on a single line as before
And no extra vertical space is added
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
<img width="1206" height="2622" alt="image"
src="https://github.com/user-attachments/assets/75355e7a-b5ba-4901-862e-61c8d44b9e82"
/>
### **After**
<!-- [screenshots/recordings] -->
<img width="790" height="1572" alt="image"
src="https://github.com/user-attachments/assets/53fe7ab4-665f-40de-ae84-671fb31b3abe"
/>
## **Pre-merge author checklist**
- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I've included tests if applicable
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk UI-only layout tweaks in the Predict buy preview header to
prevent text overflow; no business logic or data flow changes.
>
> **Overview**
> Fixes Predict buy preview header text overflow by constraining the
title row with `flex-1 min-w-0` and allowing the market title/subtitle
content to wrap instead of truncating to a single line.
>
> Also enables wrapping in the subtitle row via `flex-wrap` so long
group/outcome labels stay within screen bounds while keeping the back
button accessible.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fe227e7. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent ccf1e6c commit ad0f41c
1 file changed
Lines changed: 3 additions & 13 deletions
File tree
- app/components/UI/Predict/views/PredictBuyWithAnyToken/components/PredictBuyPreviewHeader
Lines changed: 3 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 86 | + | |
| 87 | + | |
94 | 88 | | |
95 | 89 | | |
96 | 90 | | |
97 | 91 | | |
98 | 92 | | |
99 | 93 | | |
100 | | - | |
101 | | - | |
102 | 94 | | |
103 | 95 | | |
104 | 96 | | |
| |||
119 | 111 | | |
120 | 112 | | |
121 | 113 | | |
122 | | - | |
123 | | - | |
124 | 114 | | |
125 | 115 | | |
126 | 116 | | |
| |||
0 commit comments