Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/libs/ReportActionItemEventHandler/index.android.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {InteractionManager} from 'react-native';
import type ReportActionItemEventHandler from './types';

const reportActionItemEventHandler: ReportActionItemEventHandler = {
handleComposerLayoutChange: (reportScrollManager, index) => () => {
InteractionManager.runAfterInteractions(() => {
requestAnimationFrame(() => {
reportScrollManager.scrollToIndex(index, true);
});
});
},
};

export default reportActionItemEventHandler;
7 changes: 7 additions & 0 deletions src/libs/ReportActionItemEventHandler/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type ReportActionItemEventHandler from './types';

const reportActionItemEventHandler: ReportActionItemEventHandler = {
handleComposerLayoutChange: () => () => {},
};

export default reportActionItemEventHandler;
8 changes: 8 additions & 0 deletions src/libs/ReportActionItemEventHandler/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type {LayoutChangeEvent} from 'react-native';
import type ReportScrollManagerData from '@hooks/useReportScrollManager/types';

type ReportActionItemEventHandler = {
handleComposerLayoutChange: (reportScrollManager: ReportScrollManagerData, index: number) => (event: LayoutChangeEvent) => void;
};

export default ReportActionItemEventHandler;
4 changes: 3 additions & 1 deletion src/pages/home/report/ReportActionItemMessageEdit.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import lodashDebounce from 'lodash/debounce';
import type {ForwardedRef} from 'react';
import React, {forwardRef, useCallback, useEffect, useMemo, useRef, useState} from 'react';
import {InteractionManager, Keyboard, View} from 'react-native';
import type {NativeSyntheticEvent, TextInput, TextInputFocusEventData, TextInputKeyPressEventData} from 'react-native';
import {InteractionManager, Keyboard, View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import type {Emoji} from '@assets/emojis/types';
import Composer from '@components/Composer';
Expand All @@ -29,6 +29,7 @@ import focusEditAfterCancelDelete from '@libs/focusEditAfterCancelDelete';
import {parseHtmlToMarkdown} from '@libs/OnyxAwareParser';
import onyxSubscribe from '@libs/onyxSubscribe';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
import reportActionItemEventHandler from '@libs/ReportActionItemEventHandler';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as ReportUtils from '@libs/ReportUtils';
import setShouldShowComposeInputKeyboardAware from '@libs/setShouldShowComposeInputKeyboardAware';
Expand Down Expand Up @@ -435,6 +436,7 @@ function ReportActionItemMessageEdit(
}
setShouldShowComposeInputKeyboardAware(true);
}}
onLayout={reportActionItemEventHandler.handleComposerLayoutChange(reportScrollManager, index)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused the app to automatically scroll to the edit input instead of the bottom of the list. We have applied the fix here. #70219

selection={selection}
onSelectionChange={(e) => setSelection(e.nativeEvent.selection)}
isGroupPolicyReport={isGroupPolicyReport}
Expand Down