Skip to content

Commit 8e961d5

Browse files
MelvinBotsituchan
andcommitted
Use theme.text for Android picker item color to support high contrast themes
BasePicker was using theme.textLight for Android native picker dialog items, assuming it would always be a light color. In the DARK_CONTRAST theme, textLight maps to #002E22 (a dark color), making picker items invisible on the dark native dialog background. Changed to use theme.text which is #E7ECE9 in both dark and dark-contrast themes. Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
1 parent 809efef commit 8e961d5

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

src/components/Picker/BasePicker.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import useScrollContext from '@hooks/useScrollContext';
1414
import useTheme from '@hooks/useTheme';
1515
import useThemeStyles from '@hooks/useThemeStyles';
1616
import {isMobile} from '@libs/Browser';
17-
import getOperatingSystem from '@libs/getOperatingSystem';
1817
import CONST from '@src/CONST';
1918
import getAccessibilityLabelConfig from './getAccessibilityLabelConfig';
2019
import type {BasePickerProps} from './types';
@@ -147,14 +146,10 @@ function BasePicker<TPickerValue>({
147146

148147
/**
149148
* We pass light text on Android, since Android Native alerts have a dark background in all themes for now.
149+
* We use theme.text instead of theme.textLight because textLight maps to a dark color in high contrast themes,
150+
* making picker items invisible on the dark native dialog background.
150151
*/
151-
const itemColor = useMemo(() => {
152-
if (getOperatingSystem() === CONST.OS.ANDROID) {
153-
return theme.textLight;
154-
}
155-
156-
return theme.text;
157-
}, [theme]);
152+
const itemColor = useMemo(() => theme.text, [theme]);
158153

159154
// Windows will reuse the text color of the select for each one of the options
160155
// so we might need to color accordingly so it doesn't blend with the background.

0 commit comments

Comments
 (0)