Skip to content

Commit

Permalink
feat: dialog support safe area context (#4228)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroenzo authored Jan 8, 2024
1 parent 46bd31b commit 67f1b9c
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 67f1b9c

Please sign in to comment.