callstack / callstack/react-native-paper

React Navigation and Portal

Đang mở
#4,022 8 bình luận 3 reaction 0 người được giao Xem trên GitHub
Portal question
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ả

I'm working with React Native Paper and React Navigation and am attempting to display a Dialog that appears above one of my screens and provides a list of cards. Each card, when clicked on, should navigate the user to a details screen. I'm attempting to use the Portal component to render the Dialog above the current screen. However, I'm currently getting the following error when clicking on the cards: "Uncaught Error: Couldn't find a navigation object. Is your component inside NavigationContainer?"

This appears to be because, as the documentation for Portal states "Portal allows rendering a component at a different place in the parent tree", which I take to mean completely outside of the top-level App component (and therefore outside of NavigationContainer").

My question is, does React Native Paper provide any way for Portal to access the navigation object for the rest of the app, or will I need to implement a custom Component that provides the same layout as Portal (i.e. the elevated, shaded background that my Dialog is displayed in)?

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

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

Đánh giá

Issue này chưa được đánh giá.

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.