Skip to content
Open
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
21 changes: 18 additions & 3 deletions src/components/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import * as React from 'react';
import { Animated, Easing, StyleSheet, Pressable, View } from 'react-native';
import {
Animated,
Easing,
KeyboardAvoidingView,
StyleSheet,
Pressable,
} from 'react-native';
import type { StyleProp, ViewStyle } from 'react-native';

import { useSafeAreaInsets } from 'react-native-safe-area-context';
Expand Down Expand Up @@ -206,7 +212,16 @@ function Modal({
]}
testID={`${testID}-backdrop`}
/>
<View
{/*
* Keep the modal content clear of the soft keyboard. In legacy Android
* (non edge-to-edge) the window is resized by `adjustResize`, so the
* centered content shifts up on its own. In edge-to-edge mode (Android
* 15+ default) the window is no longer resized, so we rely on
* `KeyboardAvoidingView` to reserve space for the keyboard instead. It
* measures its own frame, so it doesn't double up with `adjustResize`.
*/}
Comment on lines +215 to +222

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unnecessary comments

<KeyboardAvoidingView
behavior="padding"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this also override padding specified in style?

style={[
styles.wrapper,
{ marginTop: top, marginBottom: bottom },
Expand All @@ -223,7 +238,7 @@ function Modal({
>
{children}
</Surface>
</View>
</KeyboardAvoidingView>
</Animated.View>
);
}
Expand Down