Skip to content
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

feat: dialog support safe area context #4228

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
ViewStyle,
} from 'react-native';

import { useSafeAreaInsets } from 'react-native-safe-area-context';

import DialogActions from './DialogActions';
import DialogContent from './DialogContent';
import DialogIcon from './DialogIcon';
Expand Down Expand Up @@ -101,6 +103,7 @@ const Dialog = ({
theme: themeOverrides,
testID,
}: Props) => {
const { right, left } = useSafeAreaInsets();
const theme = useInternalTheme(themeOverrides);
const { isV3, dark, mode, colors, roundness } = theme;
const borderRadius = (isV3 ? 7 : 1) * roundness;
Expand All @@ -123,6 +126,7 @@ const Dialog = ({
{
borderRadius,
backgroundColor,
marginHorizontal: Math.max(left, right, 26),
},
styles.container,
style,
Expand Down Expand Up @@ -179,7 +183,6 @@ const styles = StyleSheet.create({
* dialog (44 pixel from the top and bottom) it won't be dismissed.
*/
marginVertical: Platform.OS === 'android' ? 44 : 0,
marginHorizontal: 26,
elevation: DIALOG_ELEVATION,
justifyContent: 'flex-start',
},
Expand Down
Loading