Skip to content

feat: prefer screen.orientation change events in useOrientation#2705

Draft
louzhedong wants to merge 1 commit into
streamich:masterfrom
louzhedong:feat/orientation-change-event
Draft

feat: prefer screen.orientation change events in useOrientation#2705
louzhedong wants to merge 1 commit into
streamich:masterfrom
louzhedong:feat/orientation-change-event

Conversation

@louzhedong
Copy link
Copy Markdown

Summary

Prefer screen.orientation.change when available and fall back to orientationchange.

Why

orientationchange is deprecated, while the Screen Orientation API exposes the modern event.

What changed

  • Updated the hook to subscribe to screen.orientation.change when possible
  • Kept the legacy orientationchange fallback
  • Added test coverage for both code paths

Verification

  • jest tests/useOrientation.test.ts
  • tsc --noEmit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant