[Bug?] ModalBottomSheet loses contexts

Đang mở
#61 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
react-native, typescript
Lĩnh vực
mobile

Hướng nghiên cứu

Start by tracing the ModalBottomSheet path used when nativeOverlay is false, focusing on the custom in-library Portal implementation that reparents the sheet. Reproduce the context-loss example, then determine whether context preservation or documenting the limitation is the intended outcome; compare the behavior with react-native-teleport if that alternative is evaluated.

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

Mô tả

enhancement

ModalBottomSheet (when not nativeOverlay) seems to use a custom in-library Portal implementation that reparents the sheet into a different tree, this makes child components/tree unable to use existing context from the tree.

// psuedocode
const Cx = createContext();

const SheetUser = () => {
  return (
    <Cx value={1}>
      <ModalBottomSheet ...>
         <Inner />
      </ModalBottomSheet>
    </Cx>
  )
}

const Inner = () => {
  const value = useContext(Cx)
  // value is always undefined
  return ...
}

This should either be documented on the documentation or it could be solved by using a library such as react-native-teleport

PS. I came across this issue while trying to add keyboard avoidance to a nativeOverlay modal sheet, and it does not seem to be really possible - keyboard state is undetectable inside the sheet. Should I make another issue for that?

Ngôn ngữ chính
Kotlin
Star
536
Fork
24
Merge trung bình
12 giờ 10 phút
Pull request đã merge (30 ngày)
22

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của software-mansion/react-native-bottom-sheet

Tất cả issue của software-mansion/react-native-bottom-sheet

Issue tương tự

Thêm issue về Kotlin

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.