From ed867239a93c2f5074f1b5c8a73252229e1ff018 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 12 Nov 2024 13:58:41 +0800 Subject: [PATCH 1/2] fix missing highlight bg color when pressing on menu item --- src/styles/utils/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index 881fbc278190..d1b28f29f8e8 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1125,19 +1125,19 @@ function getAmountWidth(amount: string): number { * Single true value will give result accordingly. */ function getItemBackgroundColorStyle(isSelected: boolean, isFocused: boolean, isDisabled: boolean, selectedBG: string, focusedBG: string): ViewStyle { - let backgroundColor; - if (isSelected) { - backgroundColor = selectedBG; - } else if (isDisabled) { - backgroundColor = undefined; - } else if (isFocused) { - backgroundColor = focusedBG; + return {backgroundColor: selectedBG}; } - return { - backgroundColor, - }; + if (isDisabled) { + return {backgroundColor: undefined}; + } + + if (isFocused) { + return {backgroundColor: focusedBG} + } + + return {}; } const staticStyleUtils = { From 1910badce53ff5b640d372f74d1d0e6dfdf8c9fa Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 12 Nov 2024 14:07:34 +0800 Subject: [PATCH 2/2] prettier --- src/styles/utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index d1b28f29f8e8..d196b3fdf09b 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1134,7 +1134,7 @@ function getItemBackgroundColorStyle(isSelected: boolean, isFocused: boolean, is } if (isFocused) { - return {backgroundColor: focusedBG} + return {backgroundColor: focusedBG}; } return {};