callstack / callstack/react-native-paper

apply safe area insets to menu

未关闭
#4,709 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug Menu
主要语言
TypeScript
星标
14.5k
派生
2.2k
平均合并
5 天 23 小时
30 天内合并 PR
12

描述

### 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:
https://github.com/callstack/react-native-paper/blob/beab66e074e2b0dfa1251ae221308178003d4a9b/src/components/Menu/Menu.tsx#L447-L451

**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

贡献指南

打开贡献指南

调研方向

从 src/components/Menu/Menu.tsx 中 additionalVerticalValue 计算所在的第 447-451 行附近开始。使用带刘海的 iPhone 上的大型 Menu 组件重现该问题,然后验证在锚点上方和下方打开的菜单都能遵循 safe-area insets,不会发生重叠或产生非预期的间隙。

由索引模型根据 Issue 内容生成。

评估

技术栈
react-native, typescript
领域
frontend, mobile
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。