Skip to content

apply safe area insets to menu #4709

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

Open
mehranabi opened this issue Apr 30, 2025 · 2 comments
Open

apply safe area insets to menu #4709

mehranabi opened this issue Apr 30, 2025 · 2 comments

Comments

@mehranabi
Copy link

Current behaviour

When I have a large component in a Menu, it can go out of the safe-area-view going behind the statusbar and the notch (photos below).

Expected behaviour

Menu should consider the SafeArea Insets when calculating the available space to show the menu on Top.

How to reproduce?

Render a large enough component in a Menu and scroll to a point that including the statusbar/notch there's enough space on top of the anchor.
The menu opens on top and goes under the statusbar/notch.

Preview

iPhone 13 mini:

What have you tried so far?

Adding SafeArea Top Inset value to the additionalVerticalValue calculated here fixes the issue:

// I don't know why but on Android measure function is wrong by 24
const additionalVerticalValue = Platform.select({
android: statusBarHeight ?? insets.top,
default: 0,
});

Although after doing this, when the menu opens below the anchor, it has a space from anchor equal to the top-inset, so more changes are needed to correctly apply the insets.

Your Environment

software version
ios 18.1
android SDK 34
react-native 0.76.9
react-native-paper 5.13.3
node v22.12.0
npm or yarn yarn 4.7.0
expo sdk ~52.0.46
Copy link

github-actions bot commented May 5, 2025

Hey! Thanks for opening the issue. Can you provide a minimal repro which demonstrates the issue? Posting a snippet of your code in the issue is useful, but it's not usually straightforward to run. A repro will help us debug the issue faster. Please try to keep the repro as small as possible. The easiest way to provide a repro is on snack.expo.dev. If it's not possible to repro it on snack.expo.dev, then you can also provide the repro in a GitHub repository.

@mehranabi
Copy link
Author

mehranabi commented May 5, 2025

Here's a snack that showcases the issue: https://snack.expo.dev/eyP4gey6Hr1QVrmzBVgnz

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants