Skip to content

Android/web: labels are unreadable in light mode when tintColor is set #966

Backlog

Description

@Naturalclar

Overview

On Android and web, setting tintColor makes the label of every segment white, including unselected ones. In light mode those labels sit on the control's light grey background (#EEEEF0), so they can't be read unless fontStyle.color is set.

With a visible selection, only the selected segment is readable, because the slider is drawn in tintColor. With momentary (supported on Android and web since #963) there is no slider, so all labels are unreadable.

Reproduction

<SegmentedControl values={['C0', 'C1', 'C2']} selectedIndex={0} momentary tintColor="#ff0000" />

Seen on an Android emulator (API 36, React Native 0.88, light mode) while testing #963. The colour logic predates #963.

Cause

getColor in js/SegmentedControlTab.js returns 'white' whenever tintColor is set, without checking whether the segment is selected. The result is also the fallback for the active label colour.

Proposal

Use white only for the selected segment, and the regular colour-scheme default (#000 / #FFF) for unselected ones. fontStyle.color and activeFontStyle.color should keep taking precedence.

One thing to decide: apps that combine tintColor with a dark backgroundColor and rely on white unselected labels in light mode would get black ones, so the change may need to take backgroundColor into account.

Acceptance criteria

  • Unselected labels are readable in light and dark mode with tintColor set.
  • A momentary control with tintColor has readable labels.
  • fontStyle.color and activeFontStyle.color still take precedence.
  • Tests cover these cases.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions