diff --git a/src/pages/home/report/ReportActionItemMessageEdit.tsx b/src/pages/home/report/ReportActionItemMessageEdit.tsx index 337d5994deac..6f2c3d72ad11 100644 --- a/src/pages/home/report/ReportActionItemMessageEdit.tsx +++ b/src/pages/home/report/ReportActionItemMessageEdit.tsx @@ -1,7 +1,7 @@ import lodashDebounce from 'lodash/debounce'; import type {ForwardedRef} from 'react'; import React, {forwardRef, useCallback, useEffect, useMemo, useRef, useState} from 'react'; -import {findNodeHandle, InteractionManager, Keyboard, View} from 'react-native'; +import {findNodeHandle, InteractionManager, View} from 'react-native'; import type {MeasureInWindowOnSuccessCallback, NativeSyntheticEvent, TextInput, TextInputFocusEventData, TextInputKeyPressEventData, TextInputScrollEventData} from 'react-native'; import {useFocusedInputHandler} from 'react-native-keyboard-controller'; import {useOnyx} from 'react-native-onyx'; @@ -45,6 +45,7 @@ import setShouldShowComposeInputKeyboardAware from '@libs/setShouldShowComposeIn import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type * as OnyxTypes from '@src/types/onyx'; +import KeyboardUtils from '@src/utils/keyboard'; import * as ReportActionContextMenu from './ContextMenu/ReportActionContextMenu'; import getCursorPosition from './ReportActionCompose/getCursorPosition'; import getScrollPosition from './ReportActionCompose/getScrollPosition'; @@ -255,9 +256,8 @@ function ReportActionItemMessageEdit( // Scroll to the last comment after editing to make sure the whole comment is clearly visible in the report. if (index === 0) { - const keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => { + KeyboardUtils.dismiss().then(() => { reportScrollManager.scrollToIndex(index, false); - keyboardDidHideListener.remove(); }); } }, [action, index, reportID, reportScrollManager, isActive]);