Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

@capacitor/screen-orientation: iOS: orientation() and screenOrientationChange event report orientation change although orientation is locked

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

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ệ
ios, swift, typescript
Lĩnh vực
mobile

Hướng nghiên cứu

Tái hiện vấn đề trên iOS bằng @capacitor/[email protected], bắt đầu với các entry point ScreenOrientation.lock(), orientation() và screenOrientationChange được mô tả ở đây. So sánh các giá trị được báo cáo sau khi khóa ở portrait-primary và xoay thiết bị; được xem là hoàn tất khi listener và orientation() phản ánh hướng màn hình đã khóa mà không thay đổi hành vi Android đã được ghi chép.

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

Mô tả

platform: ios plugin: screen-orientation type: bug

Bug Report

Plugin(s)

@capacitor/[email protected]

Capacitor Version
💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 4.7.0
  @capacitor/core: 4.7.0
  @capacitor/android: 4.7.0
  @capacitor/ios: 4.7.0

Installed Dependencies:

  @capacitor/core: 4.7.0
  @capacitor/cli: 4.7.0
  @capacitor/ios: 4.7.0
  @capacitor/android: 4.7.0

[success] iOS looking great! 👌
Platform(s)
  • iOS
Current Behavior

After locking the orientation

await ScreenOrientation.lock({orientation: "portrait-primary"})

the screenOrientationChange listener still reports changed orientations when the device is rotated as if the orientation was not locked. Calling

const {type} = await ScreenOrientation.orientation()

also returns the orientation as if the screen orientation was not locked.

The document orientation itself is locked correctly though, no matter how the device is rotated.

Expected Behavior

The screenOrientationChange listener should only report changes when the screen orientation is actually changed, not when the device is rotated while the screen orientation is locked. Likewise ScreenOrientation.orientation() should return the correct screen orientation when it is locked, no matter how the device is rotated.

This does not seem to be an issue on Android. There the screenOrientationChange listener gets only called after ScreenOrientation.lock() if it actually changed the screen orientation. ScreenOrientation.orientation() also returns the correct screen orientation after ScreenOrientation.lock() was called.

Code Reproduction
Other Technical Details
Additional Context
Ngôn ngữ chính
Java
Star
688
Fork
692
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

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 ionic-team/capacitor-plugins

Tất cả issue của ionic-team/capacitor-plugins

Issue tương tự

Thêm issue về Java

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.