Skip to content

Commit

Permalink
Merge pull request Expensify#52976 from Expensify/revert-51318-fix/50663
Browse files Browse the repository at this point in the history
Revert "fix: Submit button hang in middle page"
  • Loading branch information
cristipaval authored Nov 22, 2024
2 parents ef0d341 + 999d837 commit 3ebe852
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 62 deletions.
22 changes: 4 additions & 18 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useFocusEffect, useIsFocused} from '@react-navigation/native';
import lodashIsEqual from 'lodash/isEqual';
import React, {memo, useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';
import React, {memo, useCallback, useEffect, useMemo, useRef, useState} from 'react';
import {InteractionManager, View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
Expand Down Expand Up @@ -46,7 +46,6 @@ import type {SectionListDataType} from './SelectionList/types';
import UserListItem from './SelectionList/UserListItem';
import SettlementButton from './SettlementButton';
import Text from './Text';
import {KeyboardStateContext} from './withKeyboardState';

type MoneyRequestConfirmationListProps = {
/** Callback to inform parent modal of success */
Expand Down Expand Up @@ -195,7 +194,7 @@ function MoneyRequestConfirmationList({
const styles = useThemeStyles();
const {translate, toLocaleDigit} = useLocalize();
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const {isKeyboardShown, isWindowHeightReducedByKeyboard} = useContext(KeyboardStateContext);

const isTypeRequest = iouType === CONST.IOU.TYPE.SUBMIT;
const isTypeSplit = iouType === CONST.IOU.TYPE.SPLIT;
const isTypeSend = iouType === CONST.IOU.TYPE.PAY;
Expand Down Expand Up @@ -825,7 +824,7 @@ function MoneyRequestConfirmationList({
}, [routeError, isTypeSplit, shouldShowReadOnlySplits, debouncedFormError, formError, translate]);

const footerContent = useMemo(() => {
if (isReadOnly || isKeyboardShown || isWindowHeightReducedByKeyboard) {
if (isReadOnly) {
return;
}

Expand Down Expand Up @@ -877,20 +876,7 @@ function MoneyRequestConfirmationList({
{button}
</>
);
}, [
isReadOnly,
iouType,
confirm,
bankAccountRoute,
iouCurrencyCode,
policyID,
splitOrRequestOptions,
styles.ph1,
styles.mb2,
errorMessage,
isKeyboardShown,
isWindowHeightReducedByKeyboard,
]);
}, [isReadOnly, iouType, confirm, bankAccountRoute, iouCurrencyCode, policyID, splitOrRequestOptions, styles.ph1, styles.mb2, errorMessage]);

const listFooterContent = (
<MoneyRequestConfirmationListFooter
Expand Down
8 changes: 1 addition & 7 deletions src/components/withKeyboardState.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react';
import React, {createContext, forwardRef, useEffect, useMemo, useState} from 'react';
import {Keyboard} from 'react-native';
import useIsWindowHeightReducedByKeyboard from '@hooks/useIsWindowHeightReducedByKeyboard';
import getComponentDisplayName from '@libs/getComponentDisplayName';
import type ChildrenProps from '@src/types/utils/ChildrenProps';

Expand All @@ -11,9 +10,6 @@ type KeyboardStateContextValue = {

/** Height of the keyboard in pixels */
keyboardHeight: number;

/** Whether window height is smaller than usual due to the keyboard being open */
isWindowHeightReducedByKeyboard?: boolean;
};

const KeyboardStateContext = createContext<KeyboardStateContextValue>({
Expand All @@ -23,7 +19,6 @@ const KeyboardStateContext = createContext<KeyboardStateContextValue>({

function KeyboardStateProvider({children}: ChildrenProps): ReactElement | null {
const [keyboardHeight, setKeyboardHeight] = useState(0);
const isWindowHeightReducedByKeyboard = useIsWindowHeightReducedByKeyboard();

useEffect(() => {
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', (e) => {
Expand All @@ -43,9 +38,8 @@ function KeyboardStateProvider({children}: ChildrenProps): ReactElement | null {
() => ({
keyboardHeight,
isKeyboardShown: keyboardHeight !== 0,
isWindowHeightReducedByKeyboard,
}),
[keyboardHeight, isWindowHeightReducedByKeyboard],
[keyboardHeight],
);
return <KeyboardStateContext.Provider value={contextValue}>{children}</KeyboardStateContext.Provider>;
}
Expand Down
37 changes: 0 additions & 37 deletions src/hooks/useIsWindowHeightReducedByKeyboard/index.ts

This file was deleted.

0 comments on commit 3ebe852

Please sign in to comment.