Repository navigation
Closed
Labels
DailyKSv2Skip PaymentSkips all the payment process steps for an issue. Use it for fixed-price projects.Task
Description
Sub-issue of #97970.
Migration plan: jmgraa comment.
The currency button is implemented four times inside NumberWithSymbolForm and the flip button three times. This issue collapses each into one primitive with a minimal prop set and its own tests.
Scope
- Step: 2 of the migration plan
- Scope: 2 new primitives under
src/components/NumberForm/primitives/
Target API
<NumberForm value={amount} onInputChange={handleAmount}>
<NumberForm.Input symbol="$" position="prefix" />
<NumberForm.FlipButton />
<NumberForm.CurrencyButton currency="USD" onPress={handleCurrency} />
</NumberForm>Duplication being collapsed
Line numbers are against src/components/NumberWithSymbolForm.tsx on main.
Currency button, 4 copies:
| Line | Path | Gate |
|---|---|---|
| 515 | displayAsTextInput right hand side |
shouldShowCurrencyButton && currencyOrUnitButtonText, calls onTrailingDropdownPress |
| 647 | landscape | isSymbolPressable |
| 727 | portrait | isSymbolPressable && !!currency && !canUseTouchScreen |
| 753 | portrait | isSymbolPressable && canUseTouchScreen |
The last three are near identical — same icons.CoinsButton, same styles.minWidth18, same onSymbolButtonPress, same text={currency} — and differ only in touch gating.
Flip button, 3 copies:
| Line | Path | Gate | Negate mechanism |
|---|---|---|---|
| 502 | displayAsTextInput |
shouldShowFlipButton && allowNegativeInput && canUseTouchScreen |
internal handleFlipPress (line 470) |
| 659 | landscape | allowFlippingAmount |
caller supplied toggleNegative |
| 765 | portrait | allowFlippingAmount && canUseTouchScreen |
caller supplied toggleNegative |
Three things to fix while collapsing
- Pick one negate mechanism. Two coexist today: the internal
handleFlipPressand the caller suppliedtoggleNegative.NumberForm.FlipButtonshould own negation through the root'snegativeMode, and callers should not have to hand in a toggle. - Drop the dead parallel API.
currencyButtonLabel/onCurrencyButtonPressandcurrency/onSymbolButtonPressare two APIs for the same trailing button, resolved at lines 242 and 243 with??.NumberForm.CurrencyButtontakes one pair. - Make touch detection reactive.
const canUseTouchScreen = canUseTouchScreenUtil()at line 141 is evaluated at import time, so the touch and non touch branches never re-evaluate. Read it inside the component instead.
Also collapse the FormHelpMessage duplication (lines 672 and 739, differing only in style) into whatever the primitives share.
Out of scope
- The number pad and layout composition — #98171
- Any call site change
Acceptance criteria
- One
NumberForm.CurrencyButtonreplaces all four copies - One
NumberForm.FlipButtonreplaces all three copies - Negation is owned by the primitive, driven by the root's
negativeMode - Only one currency button API pair survives
- Touch detection is reactive, not evaluated at import time
- Dedicated tests for both primitives, covering the touch and non touch gates
-
NumberWithSymbolFormbehaviour is unchanged, and the tests from #98168 still pass - Verify that no errors appear in the JS console
Dependencies
Issue Owner
Current Issue Owner: @bernhardojMetadata
Metadata
Assignees
Labels
DailyKSv2Skip PaymentSkips all the payment process steps for an issue. Use it for fixed-price projects.Task
Activity
melvin-bot commentedon Sep 2, 2026
This issue has not been updated in over 15 days. @mountiny, @bernhardoj, @jmgraa eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
melvin-bot commentedon Sep 23, 2026
@bernhardoj
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.91-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
jmgraa commentedon Nov 13, 2026
Implementation Note & Architecture Delta
The button primitives were implemented in
src/components/AmountActionButtons/(AmountCurrencyPickerButtonandAmountSignFlipButton) and exposed through their respective composite parents:KeypadAmountEditor.CurrencyPickerButton/KeypadAmountEditor.SignFlipButton(rendered in theactionsslot)AmountFormField.CurrencyPickerButton/AmountFormField.SignFlipButton(composed as children insideAmountFormField.Input)Note
Suggested Title Update:
NumberWithSymbolForm foundation 2: Action button primitives (CurrencyPicker & SignFlip)