NativeScript / NativeScript/plugins

Android crash when displaying a custom marker info window using markerInfoContents

Đang mở Phù hợp với người mới
#680 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

Ngôn ngữ chính
TypeScript
Star
206
Fork
123
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
1

Mô tả

Android crash when displaying a custom marker info window using markerInfoContents

Using markerInfoContents to display a custom NativeScript view causes Android to crash on API 36, API 37, and a physical Android device.

Error

java.lang.IllegalStateException:
The specified child already has a parent.
You must call removeView() on the child's parent first.

Cause

In packages/google-maps/index.android.ts, the plugin adds info.view to a GridLayout container but returns the child:

container.addChild(info.view)
return info.view.nativeView

Because the returned child already belongs to the container, Google Maps attempts to attach an already-parented view.

Suggested fix

Return the wrapper container instead:

return container.nativeView

The custom information-window view should display without crashing when repeatedly opening markers.

Image

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

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

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.

Hướng nghiên cứu

Bắt đầu trong packages/google-maps/index.android.ts, tại phần xử lý markerInfoContents thêm info.view vào một GridLayout. Xác minh rằng native view được trả về là wrapper container, sau đó tái hiện bằng cách mở các marker liên tục và xác nhận rằng các custom information window không còn gây ra already-parented-child crash trên Android.

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

Đánh giá

Công nghệ
android, typescript
Lĩnh vực
mobile-dev
Loại issue
Lỗi
Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
92/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.