Skip to content

Show the commit under the viewer's image, as the web docks it - #138

Draft
jubianchi wants to merge 2 commits into
NativePHP:mainfrom
jubianchi:feat/image-viewer-commit-panel
Draft

jubianchi wants to merge 2 commits into
NativePHP:mainfrom
jubianchi:feat/image-viewer-commit-panel

Conversation

@jubianchi

@jubianchi jubianchi commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

On the web, a commit's image opens with the commit docked under it, and a button in the lightbox's toolbar undocks it to see the whole picture. The native viewer from #70 showed the image alone. This is the part of #53 that #70 left out ("Commits / reply sheet available under image with option to undock").

Depends on NativePHP/mobile-ui#193, which adds the fit detent to <native:sheet-pane> used here. Once it's merged, composer.lock needs updating to a mobile-ui that has it. Until then CI runs against mobile-ui main, where fit doesn't exist, so the tests check fails (see the comment below).

How it works:

  • The viewer (partials/image-viewer) has a <native:sheet-pane> over the bottom of the picture with the commit: a grabber, its author (avatar in their lane or live ring, name, handle and age) and its whole body.
  • detents="88,fit": it opens at fit, exactly as tall as the commit, as the web docks it. A drag takes it down to the 88pt author line, to see more of the picture, and back up, in place of the web's dock button. Down, the commit stays pinned to the top and is cut off at the bottom.
  • The drag runs on the phone; only where the pane comes to rest comes back (ShowsCommits::viewerPaneMoved(), fit or a height), so it stays where you left it from one image to the next.
  • Why sheet-pane: it's drawn inside the viewer's modal instead of being presented over it, so the picture behind keeps its pinch and pan on both platforms. I tried <native:bottom-sheet permanent background-interaction> with its fit detent too: it works over the modal, but taken down to its small detent it re-centres the commit and loses its top padding, and on Android its scrim would block the picture's gestures.
  • The commit is kept as it was when the viewer opened (viewerCommit), as its images already are. The picture keeps the room the pane takes when it's down (Display::ViewerPaneRoom), so the chevrons stay above it. Drawn up, the pane overlaps the bottom of the chevrons, as the web's docked panel overlaps the picture.

The web's zoom and download buttons aren't here: pinch already zooms, and #53 doesn't ask for downloads. Making the viewer edge to edge and swiping between images are left for a follow-up.

Tests: new cases in ImageViewerTest (the pane and what it shows, on iOS and Android; the detent kept from one image to the next, down or at fit; the commit forgotten on close). The full suite passes with the mobile-ui branch from #193.

Screenshots

iOS only: there's no Android emulator here. Taken on an iPhone 18 Pro simulator against a local devnull, with the mobile-ui branch from #193. The before shots are main's viewer on the same image.

viewer: a commit with three images, the pane drawn up to the commit's height.

iOS light iOS dark
Before
After

The pane dragged down to the author line and back up:

iOS light iOS dark

Full-quality recordings: iOS light, iOS dark

  • No visible change

🤖 Generated with Claude Code

On the web, a commit's image opens with the commit docked under it, and a
button undocks it to see the whole picture. The native viewer showed the
image alone.

The viewer now has a sheet-pane under the image with the commit's author
and its whole body, which scrolls in the pane when it's long. It opens
drawn up, as the web docks it, and a drag takes it down to the author line
and back up, in place of the web's dock button. The drag runs on the
phone; only the height it comes to rest at goes back to PHP, and the pane
stays there from one image to the next. The commit is kept as it was when
the viewer opened, as its images already are.

Refs NativePHP#53.

🤖 Generated with Claude Code
The pane opened at a fixed 360pt, which left room under a short commit
and hid the chevrons. It now uses sheet-pane's new `fit` detent, which
sizes it to the commit, and drags down to the 88pt author line. The pane
reports `fit` or a height when it comes to rest, and either is kept from
one image to the next.

With `fit` the pane keeps the commit pinned to its top when it's down, so
it's cut off at the bottom instead of moving, which a bottom sheet with a
`fit` detent didn't do.

This needs NativePHP/mobile-ui's sheet-pane `fit` detent.

Refs NativePHP#53.

🤖 Generated with Claude Code
@jubianchi

Copy link
Copy Markdown
Contributor Author

The tests check fails on purpose for now, so here's why.

Three cases in ImageViewerTest fail with "Failed asserting that 0.0 matches expected 'fit'". CI installs this branch's composer.lock, which has mobile-ui main. There, SheetPane::detent() only takes a float, so the pane's detent="fit" turns into 0.0. The fit detent this PR relies on comes with NativePHP/mobile-ui#193.

I'm leaving composer.json and composer.lock on mobile-ui main rather than pinning them to the fork branch in the meantime. Once #193 is merged, updating mobile-ui in the lock should turn the check green, with no other change here.

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