Skip to content

Commit

Permalink
Merge pull request Expensify#44428 from huult/43615-keyboard-overlap-…
Browse files Browse the repository at this point in the history
…edit-message

fix keyboard overlap composer
  • Loading branch information
puneetlath authored Jul 2, 2024
2 parents 8140b01 + 50a4af1 commit 3cbfc54
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
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)}
selection={selection}
onSelectionChange={(e) => setSelection(e.nativeEvent.selection)}
isGroupPolicyReport={isGroupPolicyReport}
Expand Down

0 comments on commit 3cbfc54

Please sign in to comment.