From 864dead0c6a87a66e7ec2cb8e1a61a50bc228d7e Mon Sep 17 00:00:00 2001 From: hurali97 Date: Thu, 11 Jan 2024 18:19:12 +0500 Subject: [PATCH] fix: lint --- src/components/Button/index.tsx | 54 ++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx index 5c7a302c9778..5fb134648134 100644 --- a/src/components/Button/index.tsx +++ b/src/components/Button/index.tsx @@ -123,36 +123,36 @@ type KeyboardShortcutComponentProps = Pick {}, pressOnEnter, allowBubble, enterKeyEventListenerPriority}: KeyboardShortcutComponentProps) { - const isFocused = useIsFocused(); - const activeElementRole = useActiveElementRole(); - - const shouldDisableEnterShortcut = useMemo(() => accessibilityRoles.includes(activeElementRole ?? '') && activeElementRole !== CONST.ACCESSIBILITY_ROLE.TEXT, [activeElementRole]); - - const keyboardShortcutCallback = useCallback( - (event?: GestureResponderEvent | KeyboardEvent) => { - if (!validateSubmitShortcut(isDisabled, isLoading, event)) { - return; - } - onPress(); - }, - [isDisabled, isLoading, onPress], - ); + const isFocused = useIsFocused(); + const activeElementRole = useActiveElementRole(); + + const shouldDisableEnterShortcut = useMemo(() => accessibilityRoles.includes(activeElementRole ?? '') && activeElementRole !== CONST.ACCESSIBILITY_ROLE.TEXT, [activeElementRole]); + + const keyboardShortcutCallback = useCallback( + (event?: GestureResponderEvent | KeyboardEvent) => { + if (!validateSubmitShortcut(isDisabled, isLoading, event)) { + return; + } + onPress(); + }, + [isDisabled, isLoading, onPress], + ); - const config = useMemo( - () => ({ - isActive: pressOnEnter && !shouldDisableEnterShortcut && isFocused, - shouldBubble: allowBubble, - priority: enterKeyEventListenerPriority, - shouldPreventDefault: false, - }), - // eslint-disable-next-line react-hooks/exhaustive-deps - [shouldDisableEnterShortcut, isFocused], - ); + const config = useMemo( + () => ({ + isActive: pressOnEnter && !shouldDisableEnterShortcut && isFocused, + shouldBubble: allowBubble, + priority: enterKeyEventListenerPriority, + shouldPreventDefault: false, + }), + // eslint-disable-next-line react-hooks/exhaustive-deps + [shouldDisableEnterShortcut, isFocused], + ); - useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ENTER, keyboardShortcutCallback, config); + useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ENTER, keyboardShortcutCallback, config); - return null; - }; + return null; +} KeyboardShortcutComponent.displayName = 'KeyboardShortcutComponent';