Skip to content

Commit

Permalink
Merge pull request #52273 from MuaazArshad/backgroundstyle
Browse files Browse the repository at this point in the history
[CP Staging] Updated Background Color Condition
  • Loading branch information
Julesssss authored Nov 11, 2024
2 parents 0275692 + 0104fc6 commit 2e34a2e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/styles/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2e34a2e

Please sign in to comment.