Skip to content

fix(mobile): move the reader's documents below the status bar - #833

Merged
huichen merged 1 commit into
mainfrom
fix/preview-inset
Sep 25, 2026
Merged

huichen merged 1 commit into
mainfrom
fix/preview-inset

Conversation

@huichen

@huichen huichen commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #832, which did not fix the reported overlap. The header still sat under the status bar after installing that build.

Why #832 was a no-op

#832 padded the reader's own surface by insets.top. The documents inside it are absoluteFill, and Yoga positions an absoluteFill child from its parent's border edge and sizes it to the border box — a parent's padding never reaches one. So the padding moved nothing: the layers kept top = 0 and full height, and the header stayed exactly where it was.

Reproduced against yoga-layout 3.2.1 with this component's structure (mobile/src/features/chat/components/PreviewModal.tsx), status bar 30dp, screen 800dp:

structure layer top layer height header screen y
padded surface, no wrapper (what #832 shipped) 0 800 0 ← still under the bar
padded surface + flex wrapper (this PR) 0 (in wrapper) 770 30
wrapper, no padding 0 800 0

(The layout algorithm agrees: in AbsoluteLayout.cpp, an inset-based absolute child is placed at parent.border() + inset and sized from parent.measuredDimension − parent.border(), never padding(). The AbsolutePositionWithoutInsetsExcludesPadding errata only covers the no-inset path, so it does not apply to absoluteFill.)

Change

  • Give the padded surface one normal flex child (previewStack, flex: 1) and hang the layers off that, so the inset actually moves the documents.
  • Everything inside a layer keeps its own coordinate space, so the measured header height used to position the overflow menu is unaffected.

Verification

  • npx jest --runInBand: 126 suites / 2004 tests pass; npm run typecheck and eslint clean.
  • New assertion pins the part that broke: every layer must descend from preview-stack, and preview-stack must be a flex: 1 box inside the padded surface. Falsified it by reverting to the fix(mobile): keep the reader's header out of the status bar #832 shape (layers as direct children of the padded box) — it fails; and by removing the inset — that assertion fails too.
  • Still not verifiable in the screenshot harness: react-native-web reads insets from CSS env(safe-area-inset-*), which is 0 in desktop Chrome, and web honours padding for absolute children (CSS) where Yoga does not — so the harness renders this identically before and after and cannot catch this class of bug.

Please re-check on the phone

The reader's header should now clear the status bar. Note the structural fix is what moves it, so if the header still overlaps, the inset value itself is wrong (i.e. the app's own insets are 0 in that window) and I would look there instead.

#832 padded the reader's surface by the status-bar inset, but the header did
not move: Yoga positions an `absoluteFill` child from its parent's *border*
edge and sizes it to the border box, so a parent's padding never reaches one.
The layers are absoluteFill, so that padding was a no-op and the header stayed
under the status bar.

Verified against yoga-layout 3.2.1 with this component's structure: an
absolute child of a box padded by 30 kept `top = 0` and its full height, and
its header landed at screen y = 0 — reproducing the reported overlap — while
the same tree with a flex wrapper inside the padding put the header at y = 30.

Give the padded surface one normal flex child (`previewStack`) and hang the
layers off that, so the inset actually moves the documents. Everything inside
a layer keeps its own coordinate space, so the measured header height that
positions the overflow menu is still correct.
@huichen
huichen enabled auto-merge (squash) September 25, 2026 12:00
@huichen
huichen merged commit dd80c63 into main Sep 25, 2026
12 checks passed
@huichen
huichen deleted the fix/preview-inset branch September 25, 2026 12:02
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