Skip to content

Commit e1d726e

Browse files
authored
Merge pull request #48128 from Krishna2323/krishna2323/issue/48061
fix: Expense - Unable to create a new line in description field with SHIFT+ENTER.
2 parents 562d7b4 + 9c6936f commit e1d726e

File tree

2 files changed

+67
-2
lines changed

2 files changed

+67
-2
lines changed

src/CONST.ts

+65
Original file line numberDiff line numberDiff line change
@@ -3803,6 +3803,71 @@ const CONST = {
38033803
EXPENSIFY_LOGO_SIZE_RATIO: 0.22,
38043804
EXPENSIFY_LOGO_MARGIN_RATIO: 0.03,
38053805
},
3806+
3807+
/**
3808+
* Acceptable values for the `accessibilityRole` prop on react native components.
3809+
*
3810+
* **IMPORTANT:** Do not use with the `role` prop as it can cause errors.
3811+
*
3812+
* @deprecated ACCESSIBILITY_ROLE is deprecated. Please use CONST.ROLE instead.
3813+
*/
3814+
ACCESSIBILITY_ROLE: {
3815+
/**
3816+
* @deprecated Please stop using the accessibilityRole prop and use the role prop instead.
3817+
*/
3818+
BUTTON: 'button',
3819+
3820+
/**
3821+
* @deprecated Please stop using the accessibilityRole prop and use the role prop instead.
3822+
*/
3823+
LINK: 'link',
3824+
3825+
/**
3826+
* @deprecated Please stop using the accessibilityRole prop and use the role prop instead.
3827+
*/
3828+
MENUITEM: 'menuitem',
3829+
3830+
/**
3831+
* @deprecated Please stop using the accessibilityRole prop and use the role prop instead.
3832+
*/
3833+
TEXT: 'text',
3834+
3835+
/**
3836+
* @deprecated Please stop using the accessibilityRole prop and use the role prop instead.
3837+
*/
3838+
RADIO: 'radio',
3839+
3840+
/**
3841+
* @deprecated Please stop using the accessibilityRole prop and use the role prop instead.
3842+
*/
3843+
IMAGEBUTTON: 'imagebutton',
3844+
3845+
/**
3846+
* @deprecated Please stop using the accessibilityRole prop and use the role prop instead.
3847+
*/
3848+
CHECKBOX: 'checkbox',
3849+
3850+
/**
3851+
* @deprecated Please stop using the accessibilityRole prop and use the role prop instead.
3852+
*/
3853+
SWITCH: 'switch',
3854+
3855+
/**
3856+
* @deprecated Please stop using the accessibilityRole prop and use the role prop instead.
3857+
*/
3858+
ADJUSTABLE: 'adjustable',
3859+
3860+
/**
3861+
* @deprecated Please stop using the accessibilityRole prop and use the role prop instead.
3862+
*/
3863+
IMAGE: 'image',
3864+
3865+
/**
3866+
* @deprecated Please stop using the accessibilityRole prop and use the role prop instead.
3867+
*/
3868+
TEXTBOX: 'textbox',
3869+
},
3870+
38063871
/**
38073872
* Acceptable values for the `role` attribute on react native components.
38083873
*

src/components/Button/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ type ButtonProps = Partial<ChildrenProps> & {
137137

138138
type KeyboardShortcutComponentProps = Pick<ButtonProps, 'isDisabled' | 'isLoading' | 'onPress' | 'pressOnEnter' | 'allowBubble' | 'enterKeyEventListenerPriority'>;
139139

140-
const accessibilityRoles: string[] = Object.values(CONST.ROLE);
140+
const accessibilityRoles: string[] = Object.values(CONST.ACCESSIBILITY_ROLE);
141141

142142
function KeyboardShortcutComponent({isDisabled = false, isLoading = false, onPress = () => {}, pressOnEnter, allowBubble, enterKeyEventListenerPriority}: KeyboardShortcutComponentProps) {
143143
const isFocused = useIsFocused();
144144
const activeElementRole = useActiveElementRole();
145145

146-
const shouldDisableEnterShortcut = useMemo(() => accessibilityRoles.includes(activeElementRole ?? '') && activeElementRole !== CONST.ROLE.PRESENTATION, [activeElementRole]);
146+
const shouldDisableEnterShortcut = useMemo(() => accessibilityRoles.includes(activeElementRole ?? '') && activeElementRole !== CONST.ACCESSIBILITY_ROLE.TEXT, [activeElementRole]);
147147

148148
const keyboardShortcutCallback = useCallback(
149149
(event?: GestureResponderEvent | KeyboardEvent) => {

0 commit comments

Comments
 (0)