Skip to content

Commit 3543106

Browse files
committed
fix: Workspace - Taxes - Can't press Enter on creating tax rate.
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
1 parent 1bf3bd0 commit 3543106

6 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/components/AmountPicker/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, {forwardRef, useState} from 'react';
22
import type {ForwardedRef} from 'react';
33
import {View} from 'react-native';
44
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
5+
import blurActiveElement from '@libs/Accessibility/blurActiveElement';
56
import CONST from '@src/CONST';
67
import callOrReturn from '@src/types/utils/callOrReturn';
78
import AmountSelectorModal from './AmountSelectorModal';
@@ -16,6 +17,7 @@ function AmountPicker({value, description, title, errorText = '', onInputChange,
1617

1718
const hidePickerModal = () => {
1819
setIsPickerVisible(false);
20+
blurActiveElement();
1921
};
2022

2123
const updateInput = (updatedValue: string) => {

src/components/Form/FormWrapper.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ function FormWrapper({
8484
scrollContextEnabled = false,
8585
shouldHideFixErrorsAlert = false,
8686
disablePressOnEnter = false,
87+
enterKeyEventListenerPriority = 1,
8788
isSubmitDisabled = false,
8889
shouldRenderFooterAboveSubmit = false,
8990
isLoading = false,
@@ -188,6 +189,7 @@ function FormWrapper({
188189
),
189190
[
190191
disablePressOnEnter,
192+
enterKeyEventListenerPriority,
191193
enabledWhenOffline,
192194
errorMessage,
193195
errors,

src/components/Form/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ type FormProps<TFormID extends OnyxFormKey = OnyxFormKey> = {
166166
/** Disable press on enter for submit button */
167167
disablePressOnEnter?: boolean;
168168

169+
/** The priority to assign the enter key event listener to buttons. 0 is the highest priority. */
170+
enterKeyEventListenerPriority?: number;
171+
169172
/** Render extra button above submit button */
170173
shouldRenderFooterAboveSubmit?: boolean;
171174
/**

src/pages/workspace/reportFields/CreateReportFieldsPage.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ function WorkspaceCreateReportFieldsPage({
102102
setInitialCreateReportFieldsForm();
103103
}, []);
104104

105-
const [modal] = useOnyx(ONYXKEYS.MODAL, {canBeMissing: true});
106-
107105
const listValues = [...(formDraft?.[INPUT_IDS.LIST_VALUES] ?? [])].sort(localeCompare).join(', ');
108106

109107
return (
@@ -132,7 +130,6 @@ function WorkspaceCreateReportFieldsPage({
132130
submitButtonText={translate('common.save')}
133131
enabledWhenOffline
134132
shouldValidateOnBlur={false}
135-
disablePressOnEnter={!!modal?.isVisible}
136133
addBottomSafeAreaPadding
137134
>
138135
{({inputValues}) => (

src/pages/workspace/reportFields/InitialListValueSelector/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {View} from 'react-native';
44
import type {MenuItemBaseProps} from '@components/MenuItem';
55
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
66
import useOnyx from '@hooks/useOnyx';
7+
import blurActiveElement from '@libs/Accessibility/blurActiveElement';
78
import CONST from '@src/CONST';
89
import ONYXKEYS from '@src/ONYXKEYS';
910
import InitialListValueSelectorModal from './InitialListValueSelectorModal';
@@ -30,6 +31,7 @@ function InitialListValueSelector({value = '', label = '', rightLabel, subtitle
3031

3132
const hidePickerModal = () => {
3233
setIsPickerVisible(false);
34+
blurActiveElement();
3335
};
3436

3537
const updateValueInput = (initialValue: string) => {

src/pages/workspace/reportFields/TypeSelector/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {View} from 'react-native';
55
import type {MenuItemBaseProps} from '@components/MenuItem';
66
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
77
import useLocalize from '@hooks/useLocalize';
8+
import blurActiveElement from '@libs/Accessibility/blurActiveElement';
89
import * as WorkspaceReportFieldUtils from '@libs/WorkspaceReportFieldUtils';
910
import type {ReportFieldItemType} from '@pages/workspace/reportFields/ReportFieldTypePicker';
1011
import CONST from '@src/CONST';
@@ -36,6 +37,7 @@ function TypeSelector({value, label = '', rightLabel, subtitle = '', errorText =
3637

3738
const hidePickerModal = () => {
3839
setIsPickerVisible(false);
40+
blurActiveElement();
3941
};
4042

4143
const updateTypeInput = (reportField: ReportFieldItemType) => {

0 commit comments

Comments
 (0)