Skip to content

Commit b9ac650

Browse files
authored
Merge pull request #59645 from daledah/fix/58947
fix: close keyboard before scroll when editing message
2 parents 6d6628c + c582e95 commit b9ac650

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pages/home/report/ReportActionItemMessageEdit.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import lodashDebounce from 'lodash/debounce';
22
import type {ForwardedRef} from 'react';
33
import React, {forwardRef, useCallback, useEffect, useMemo, useRef, useState} from 'react';
4-
import {findNodeHandle, InteractionManager, Keyboard, View} from 'react-native';
4+
import {findNodeHandle, InteractionManager, View} from 'react-native';
55
import type {MeasureInWindowOnSuccessCallback, NativeSyntheticEvent, TextInput, TextInputFocusEventData, TextInputKeyPressEventData, TextInputScrollEventData} from 'react-native';
66
import {useFocusedInputHandler} from 'react-native-keyboard-controller';
77
import {useOnyx} from 'react-native-onyx';
@@ -45,6 +45,7 @@ import setShouldShowComposeInputKeyboardAware from '@libs/setShouldShowComposeIn
4545
import CONST from '@src/CONST';
4646
import ONYXKEYS from '@src/ONYXKEYS';
4747
import type * as OnyxTypes from '@src/types/onyx';
48+
import KeyboardUtils from '@src/utils/keyboard';
4849
import * as ReportActionContextMenu from './ContextMenu/ReportActionContextMenu';
4950
import getCursorPosition from './ReportActionCompose/getCursorPosition';
5051
import getScrollPosition from './ReportActionCompose/getScrollPosition';
@@ -255,9 +256,8 @@ function ReportActionItemMessageEdit(
255256

256257
// Scroll to the last comment after editing to make sure the whole comment is clearly visible in the report.
257258
if (index === 0) {
258-
const keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => {
259+
KeyboardUtils.dismiss().then(() => {
259260
reportScrollManager.scrollToIndex(index, false);
260-
keyboardDidHideListener.remove();
261261
});
262262
}
263263
}, [action, index, reportID, reportScrollManager, isActive]);

0 commit comments

Comments
 (0)