From 08fae8d8b5613de102c69bfe4f0cb03c00f3857c Mon Sep 17 00:00:00 2001 From: Jules Date: Mon, 11 Nov 2024 09:56:54 +0000 Subject: [PATCH] Merge pull request #52273 from MuaazArshad/backgroundstyle [CP Staging] Updated Background Color Condition (cherry picked from commit 2e34a2eeaae36f257dba2b196516c344491251f6) (CP triggered by Julesssss) --- src/styles/utils/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index 02778b4ca351..881fbc278190 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1119,13 +1119,18 @@ function getAmountWidth(amount: string): number { return width; } +/** + * When the item is selected and disabled, we want selected item styles. + * When the item is focused and disabled, we want disabled item styles. + * Single true value will give result accordingly. + */ function getItemBackgroundColorStyle(isSelected: boolean, isFocused: boolean, isDisabled: boolean, selectedBG: string, focusedBG: string): ViewStyle { let backgroundColor; - if (isDisabled) { - backgroundColor = undefined; - } else if (isSelected) { + if (isSelected) { backgroundColor = selectedBG; + } else if (isDisabled) { + backgroundColor = undefined; } else if (isFocused) { backgroundColor = focusedBG; }