-
Notifications
You must be signed in to change notification settings - Fork 30
fix(components-native): Fix Form's bottom inset SafeArea for inline type FormActionBar #2813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import React, { useMemo } from "react"; | ||
| import React from "react"; | ||
| import { View } from "react-native"; | ||
| import { useSafeAreaInsets } from "react-native-safe-area-context"; | ||
| import { useStyles } from "./FormBody.style"; | ||
| import { useScreenInformation } from "../../hooks/useScreenInformation"; | ||
| import type { FormActionBarProps } from "../FormActionBar"; | ||
|
|
@@ -25,13 +26,12 @@ export function FormBody({ | |
| setSaveButtonHeight, | ||
| saveButtonOffset, | ||
| }: FormBodyProps): JSX.Element { | ||
| const paddingBottom = useBottomPadding(); | ||
| const fullViewPadding = useMemo(() => ({ paddingBottom }), [paddingBottom]); | ||
| const { bottom: paddingBottom } = useSafeAreaInsets(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| const styles = useStyles(); | ||
|
|
||
| return ( | ||
| <> | ||
| <View style={[styles.container]}> | ||
| <View style={styles.container}> | ||
| {children} | ||
| {shouldRenderActionBar && ( | ||
| <FormActionBar | ||
|
|
@@ -47,9 +47,9 @@ export function FormBody({ | |
| )} | ||
| </View> | ||
|
|
||
| {shouldRenderActionBar && !saveButtonOffset && ( | ||
| {!saveButtonOffset && ( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the crux of the fix, where I show this extra "safeArea" view at all times |
||
| <View | ||
| style={[fullViewPadding, styles.safeArea]} | ||
| style={[{ paddingBottom }, styles.safeArea]} | ||
| testID="ATL-FormSafeArea" | ||
| /> | ||
| )} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@omairJobber this did not seem necessary with this fix