From 50798ab62c204738db251500d716217accc26d70 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Wed, 10 Jul 2024 22:29:00 +0700 Subject: [PATCH 1/5] update state correctly --- src/components/PopoverMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index 0f97a3c4414f..7874a7859da3 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -158,7 +158,7 @@ function PopoverMenu({ onPress={() => { setCurrentMenuItems(previousMenuItems); setFocusedIndex(-1); - enteredSubMenuIndexes.splice(-1); + setEnteredSubMenuIndexes((prevState) => prevState.slice(0, -1)) }} /> ); From 9676f602aaf21d1c158056aca0cae7530f4de4e6 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Wed, 10 Jul 2024 23:21:52 +0700 Subject: [PATCH 2/5] fix errors --- src/components/PopoverMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index 7874a7859da3..b08351af5430 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -158,7 +158,7 @@ function PopoverMenu({ onPress={() => { setCurrentMenuItems(previousMenuItems); setFocusedIndex(-1); - setEnteredSubMenuIndexes((prevState) => prevState.slice(0, -1)) + setEnteredSubMenuIndexes((prevState) => prevState.slice(0, -1)); }} /> ); From 06faee8306f321bd88265c255f9015c39bc059ca Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Sat, 13 Jul 2024 16:15:50 +0700 Subject: [PATCH 3/5] render header text --- src/components/PopoverMenu.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index b08351af5430..78108a6e97af 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -164,6 +164,13 @@ function PopoverMenu({ ); }; + const renderHeaderText = () => { + if (!headerText || enteredSubMenuIndexes.length !== 0) { + return; + } + return {headerText}; + }; + useKeyboardShortcut( CONST.KEYBOARD_SHORTCUTS.ENTER, () => { @@ -215,7 +222,7 @@ function PopoverMenu({ > - {!!headerText && enteredSubMenuIndexes.length === 0 && {headerText}} + {renderHeaderText()} {enteredSubMenuIndexes.length > 0 && renderBackButtonItem()} {currentMenuItems.map((item, menuIndex) => ( Date: Wed, 17 Jul 2024 19:54:34 +0700 Subject: [PATCH 4/5] handle conflict --- src/components/PopoverMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index cdd3f4bb778e..3a59f1e8d349 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -158,7 +158,7 @@ function PopoverMenu({ onPress={() => { setCurrentMenuItems(previousMenuItems); setFocusedIndex(-1); - setEnteredSubMenuIndexes(enteredSubMenuIndexes.slice(0, -1)); + setEnteredSubMenuIndexes((prevState) => prevState.slice(0, -1)) }} /> ); From b4a40239ea9432607880d28f8ef3a9c5bf42a82c Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Wed, 17 Jul 2024 19:55:34 +0700 Subject: [PATCH 5/5] handle conflict --- src/components/PopoverMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index 3a59f1e8d349..d41c1a9aaa63 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -158,7 +158,7 @@ function PopoverMenu({ onPress={() => { setCurrentMenuItems(previousMenuItems); setFocusedIndex(-1); - setEnteredSubMenuIndexes((prevState) => prevState.slice(0, -1)) + setEnteredSubMenuIndexes((prevState) => prevState.slice(0, -1)); }} /> );