From 4e9130ac29c9d6e9495c115981c2477c9a9c63d9 Mon Sep 17 00:00:00 2001
From: Joel Jeremy Marquez <joeljeremy.marquez@gmail.com>
Date: Tue, 9 Apr 2024 13:08:02 -0700
Subject: [PATCH] [Mobile] Fix report budget income budgeted input (#2573)

* Fix mobile report budget income budgeted input

* Release notes
---
 .../components/mobile/budget/BudgetTable.jsx  | 24 ++++++++-----------
 upcoming-release-notes/2573.md                |  6 +++++
 2 files changed, 16 insertions(+), 14 deletions(-)
 create mode 100644 upcoming-release-notes/2573.md

diff --git a/packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx b/packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx
index 952d70c63..e004f887e 100644
--- a/packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx
+++ b/packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx
@@ -681,10 +681,17 @@ const IncomeCategory = memo(function IncomeCategory({
   style,
   onEdit,
   onBudgetAction,
-  isEditingBudget,
-  onEditBudget,
 }) {
   const listItemRef = useRef();
+  const [isEditingBudget, setIsEditingBudget] = useState(false);
+  const { onRequestActiveEdit, onClearActiveEdit } = useSingleActiveEditForm();
+
+  const onEditBudget = () => {
+    onRequestActiveEdit(`${category.id}-budget`, () => {
+      setIsEditingBudget(true);
+      return () => setIsEditingBudget(false);
+    });
+  };
 
   return (
     <ListItem
@@ -742,15 +749,8 @@ const IncomeCategory = memo(function IncomeCategory({
             onBudgetAction={onBudgetAction}
             isEditing={isEditingBudget}
             onEdit={onEditBudget}
+            onBlur={onClearActiveEdit}
           />
-          {/* <CellValue
-            binding={budget}
-            style={{
-              ...styles.smallText,
-              textAlign: 'right',
-            }}
-            type="financial"
-          /> */}
         </View>
       )}
       <View
@@ -951,8 +951,6 @@ function IncomeGroup({
   editMode,
   onEditGroup,
   onEditCategory,
-  editingBudgetCategoryId,
-  onEditCategoryBudget,
   onBudgetAction,
 }) {
   return (
@@ -1016,8 +1014,6 @@ function IncomeGroup({
                 editMode={editMode}
                 onEdit={onEditCategory}
                 onBudgetAction={onBudgetAction}
-                isEditingBudget={editingBudgetCategoryId === category.id}
-                onEditBudget={onEditCategoryBudget}
               />
             );
           })}
diff --git a/upcoming-release-notes/2573.md b/upcoming-release-notes/2573.md
new file mode 100644
index 000000000..c25b7eae0
--- /dev/null
+++ b/upcoming-release-notes/2573.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [joel-jeremy]
+---
+
+Fix mobile report budget bug where you can't click on an income category's budgeted input.
-- 
GitLab