Skip to content

Commit

Permalink
fix: submit button overlapping form content
Browse files Browse the repository at this point in the history
  • Loading branch information
pac-guerreiro committed May 17, 2024
1 parent f7195c0 commit 49e9755
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/components/Form/FormProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ type FormProviderProps<TFormID extends OnyxFormKey = OnyxFormKey> = FormProvider

/** Whether to apply flex to the submit button */
submitFlexEnabled?: boolean;

/** Whether the form container should grow or adapt to the viewable available space */
shouldContainerGrow?: boolean;
};

function FormProvider(
Expand Down
8 changes: 6 additions & 2 deletions src/components/Form/FormWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ type FormWrapperProps = ChildrenProps &
/** Whether to apply flex to the submit button */
submitFlexEnabled?: boolean;

/** Whether the form container should grow or adapt to the viewable available space */
shouldContainerGrow?: boolean;

/** Server side errors keyed by microtime */
errors: FormInputErrors;

Expand Down Expand Up @@ -60,6 +63,7 @@ function FormWrapper({
scrollContextEnabled = false,
shouldHideFixErrorsAlert = false,
disablePressOnEnter = true,
shouldContainerGrow = true,
}: FormWrapperProps) {
const styles = useThemeStyles();
const formRef = useRef<RNScrollView>(null);
Expand Down Expand Up @@ -155,7 +159,7 @@ function FormWrapper({
scrollContextEnabled ? (
<ScrollViewWithContext
style={[styles.w100, styles.flex1]}
contentContainerStyle={styles.flex1}
contentContainerStyle={shouldContainerGrow ? styles.flexGrow1 : styles.flex1}
keyboardShouldPersistTaps="handled"
ref={formRef}
>
Expand All @@ -164,7 +168,7 @@ function FormWrapper({
) : (
<ScrollView
style={[styles.w100, styles.flex1]}
contentContainerStyle={styles.flex1}
contentContainerStyle={shouldContainerGrow ? styles.flexGrow1 : styles.flex1}
keyboardShouldPersistTaps="handled"
ref={formRef}
>
Expand Down
1 change: 1 addition & 0 deletions src/pages/iou/request/step/IOURequestStepWaypoint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ function IOURequestStepWaypoint({
validate={validate}
onSubmit={submit}
submitFlexEnabled={false}
shouldContainerGrow={false}
shouldValidateOnChange={false}
shouldValidateOnBlur={false}
isSubmitButtonVisible={isSubmitButtonVisible}
Expand Down

0 comments on commit 49e9755

Please sign in to comment.