Skip to content

Button - Final cleanups: textAlignLeft, fill fallbacks, and should* prop renames #90196

@mountiny

Description

@mountiny

Sub-issue of #83762. Covers Tasks 3, 4 & 7 of @Guccio163's Apr 27 follow-up proposal, grouped per the May 11 split comment.

This is the third and final of three sub-issues. It is blocked by the <Link /> extraction sub-issue so the renames don't collide with the new <Link /> API surface.

Background

Three independent cleanups are bundled here because they are all small, mechanical, and share the same review surface (Button props and call sites):

  1. Button.Text applies textAlignLeft conditionally when iconLeft is present, but it has a visible effect only when textNumberOfLines > 1 — exactly one real-world case in the codebase.
  2. ButtonWithIcons falls back to iconLeftFill / iconLeftHoverFill when iconRightFill / iconRightHoverFill are not provided. This is implicit coupling between unrelated props.
  3. Several should* props carry the prefix unnecessarily — they are simple opt-in flags or enums.

Scope

Remove conditional textAlignLeft from Button.Text

In ButtonWithIcons.tsx lines 137 & 144, the wrapper passes [!!iconLeft && styles.textAlignLeft, textStyles] into Button.Text / ButtonDoubleLineText. Remove the conditional, and migrate the one real-world multi-line case to pass textStyles={[styles.textAlignLeft]} at the call site.

Remove iconRightFill / iconRightHoverFill fallback

In ButtonWithIcons.tsx lines 154–155:

fill={iconRightFill ?? iconLeftFill}
hoverFill={iconRightHoverFill ?? iconLeftHoverFill}

Drop the fallback. Audit existing call sites that relied on it and pass iconRightFill / iconRightHoverFill explicitly where the right icon should match the left.

Rename should* props

Current Proposed Notes
shouldRemoveBorderRadius removeBorderRadius?: 'left' | 'right' | 'all' Already an enum in the new API — the name just retains the old boolean prefix.
shouldEnableHapticFeedback hapticFeedback?: boolean Opt-in feature flag — no need for the "should" framing.
shouldBlendOpacity blendOpacity?: boolean Same reasoning; passed through to PressableWithFeedback, so a coordinated rename may be needed there too.
shouldStayNormalOnDisable stayNormalOnDisable?: boolean Simple rename — removes the "should" prefix while keeping the same boolean semantics.

These renames touch at minimum:

For shouldBlendOpacityblendOpacity, also update the corresponding prop on PressableWithFeedback if reviewers prefer a coordinated rename.

Acceptance criteria

  • No !!iconLeft && styles.textAlignLeft (or equivalent) inside ButtonComposed; the multi-line use case has been moved to the call site.
  • No iconRightFill ?? iconLeftFill / iconRightHoverFill ?? iconLeftHoverFill fallback in ButtonWithIcons; affected call sites pass explicit values.
  • All four should* props renamed and every call site migrated; no references to the old names remain in production code.

Dependencies

  • Blocked by the <Link /> extraction sub-issue — to avoid renaming props that change shape during Link extraction.
Issue OwnerCurrent Issue Owner: @ZhenjaHorbach

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions