Skip to content

feat(native-overlay): add contentSize for non-sheet content - #205

Merged
limichange merged 1 commit into
mainfrom
feat/native-overlay-content-size
Nov 5, 2026
Merged

limichange merged 1 commit into
mainfrom
feat/native-overlay-content-size

Conversation

@limichange

@limichange limichange commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds an optional contentSize prop to OverlayView for non-sheet presentations, so a caller can lay its content out at the size of the window it is about to rotate into.

Why

JS lays non-sheet overlay content out at the window size it last saw (useWindowDimensions), and the Android content host clips the content to that frame. JS hears about a rotation only after the window has rotated, so for the first rotated frames the content keeps the previous orientation's frame and is cut off.

OneKey's Android native chart fullscreen hits this: it prepares a hidden landscape layer in an OverlayView, rotates the window, and shows the layer as the rotation starts. Without contentSize, the first landscape frames show only the part of the layer inside the stale portrait frame, with the page visible beside it, until JS processes the new window size.

Changes

  • OverlayViewTypes.ts: optional contentSize?: { width, height } (native, non-sheet).
  • contentSize.ts: resolveContentSize picks the caller size over the window size; omitted, the content follows the window size as before.
  • OverlayView.tsx: the non-sheet content frame uses resolveContentSize.
  • docs/SPEC.md: new "Content size for windows about to rotate" section under 5.6, the prop in the 5.3 component sketch, and the new test in 5.9.

Spec audit

  • Behavior is documented in 5.6 "Content size for windows about to rotate"; defaults are unchanged when the prop is omitted.
  • Sheets ignore it (they size from the sheet geometry); Web ignores it (the DOM overlay sizes itself with CSS).
  • No native code changes; no lifecycle, event ordering, or cleanup changes.

Validation

  • yarn typecheck passes.
  • yarn lint: 0 errors; the same 12 pre-existing inline-style warnings as main; Prettier clean.
  • yarn test: 10 suites, 103 tests pass, including the new contentSize.test.ts.
  • Runtime: verified on an Android API 36 emulator through an equivalent patch in fix: smooth Android native chart fullscreen transitions app-monorepo#14312 (native chart fullscreen), which removes the patch once this is released: the first landscape frame shows the whole layer. iOS takes the same JS layout path but was not runtime-verified here.

🤖 Generated with Claude Code

JS lays non-sheet overlay content out at the window size it last saw, and the Android content host clips the content to that frame. Right after the window rotates, JS still holds the previous size, so content prepared for the rotated window is cut off until JS catches up.

contentSize lets a caller lay the content out at the size of the window it is about to rotate into, so the first rotated frame shows all of it. Omitted, the content follows the window size as before. The spec documents the behavior and its platform scope.
@sidmorizon

Copy link
Copy Markdown
Contributor

Devin Cloud review ↗

@limichange
limichange merged commit a598da9 into main Nov 5, 2026
14 checks passed
@limichange
limichange deleted the feat/native-overlay-content-size branch November 5, 2026 02:28
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.

3 participants