callstack / callstack/react-native-paper

🚀 Feature Request: Preserve Anchor Alignment in Upward-Opening `Menu` with Dynamic Content

Đang mở
#4,747 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
feature request
Ngôn ngữ chính
TypeScript
Star
14.5k
Fork
2.2k
Merge trung bình
5 ngày 23 giờ
Pull request đã merge (30 ngày)
12

Mô tả

## Description

When using the `Menu` component from `react-native-paper` as a dropdown in an autocomplete-style UI, there is a UX inconsistency when the menu opens **upwards** from its anchor and its content is **dynamically filtered**.

Currently, when filtering the list while the menu is already open (e.g., user types to refine suggestions):

- The menu shrinks to fit the updated result set,
- But it does **not maintain a fixed position relative to its anchor**,
- Resulting in the menu shifting upward, giving the impression that it is disconnected from its triggering anchor.

This behavior is especially noticeable in autocomplete scenarios, where the menu’s height often changes as the user types.

---

## Proposed Behavior

It would be beneficial if the `Menu` component:

- Could maintain **visual alignment with its anchor**, even when the content height changes,
- Especially when opened **upward** due to limited space below the anchor,
- Adjusted its top boundary instead of bottom when opened upward, preserving anchor binding.

This feature would greatly enhance the usability of the `Menu` in dynamic UIs, such as autocomplete components or filterable lists.

---

## Suggested Enhancements

- Add a prop like `preserveAnchorAlignment` or `stickToAnchor` that keeps the menu visually connected to the anchor during dynamic content changes.
- Internally detect when the menu opens upward, and adjust only the top boundary to maintain anchor alignment when the height changes.
- Optionally expose a more flexible positioning strategy API for menus that change in size after mounting.

---

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Không có file hay test nào được nêu tên. Hãy bắt đầu bằng cách xác định logic định vị của component Menu và xem xét cách các menu mở lên trên phản ứng với những thay đổi nội dung động. Công việc được xem là hoàn tất khi menu vẫn được căn chỉnh trực quan với anchor của nó trong khi nội dung đã lọc thay đổi, và hành vi định vị được bao phủ bằng các test phù hợp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
react-native, typescript
Lĩnh vực
frontend, mobile
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.