diff --git a/src/components/FormAlertWithSubmitButton.tsx b/src/components/FormAlertWithSubmitButton.tsx index cd177a1d77a3..e9b7b27f1475 100644 --- a/src/components/FormAlertWithSubmitButton.tsx +++ b/src/components/FormAlertWithSubmitButton.tsx @@ -1,6 +1,7 @@ import React from 'react'; import type {StyleProp, ViewStyle} from 'react-native'; import {View} from 'react-native'; +import useSafePaddingBottomStyle from '@hooks/useSafePaddingBottomStyle'; import useThemeStyles from '@hooks/useThemeStyles'; import Button from './Button'; import FormAlertWrapper from './FormAlertWrapper'; @@ -79,10 +80,11 @@ function FormAlertWithSubmitButton({ }: FormAlertWithSubmitButtonProps) { const styles = useThemeStyles(); const style = [!footerContent ? {} : styles.mb3, buttonStyles]; + const safePaddingBottomStyle = useSafePaddingBottomStyle(); return ( { + const styles = useThemeStyles(); + const [willKeyboardShow, setWillKeyboardShow] = useState(false); + useEffect(() => { + const keyboardWillShowListener = Keyboard.addListener('keyboardWillShow', () => { + setWillKeyboardShow(true); + }); + const keyboardWillHideListener = Keyboard.addListener('keyboardWillHide', () => { + setWillKeyboardShow(false); + }); + return () => { + keyboardWillShowListener.remove(); + keyboardWillHideListener.remove(); + }; + }, []); + + const {paddingBottom} = useStyledSafeAreaInsets(); + + const extraPaddingBottomStyle = useMemo(() => { + // Do not add extra padding at the bottom if the keyboard is open or if there is no safe area bottom padding style. + if (willKeyboardShow || !paddingBottom) { + return {}; + } + return styles.pb5; + }, [willKeyboardShow, paddingBottom, styles.pb5]); + return extraPaddingBottomStyle; +}; + +export default useSafePaddingBottomStyle; diff --git a/src/pages/iou/request/step/IOURequestStepDate.tsx b/src/pages/iou/request/step/IOURequestStepDate.tsx index 63ac316970f8..45c9fc0aaa2e 100644 --- a/src/pages/iou/request/step/IOURequestStepDate.tsx +++ b/src/pages/iou/request/step/IOURequestStepDate.tsx @@ -117,6 +117,7 @@ function IOURequestStepDate({ shouldShowNotFoundPage={shouldShowNotFound} shouldShowWrapper testID={IOURequestStepDate.displayName} + includeSafeAreaPaddingBottom={false} >