Repository navigation
feat: JSON Canvas on Android as on iOS, with Material 3's card menu - #107
Merged
Merged
Conversation
…down CanvasNodeMenu, from the new ./menu entry point, is Compose's DropdownMenu (through @expo/ui, an optional peer) anchored to the long-pressed card: below it, or above with no room below, lined up with its leading edge, and at the finger when the card fills most of the view. The card is outlined in the theme's primary colour while its menu is open. Items take a title, a Material Symbol icon and a destructive flag; an optional title labels the menu. Off Android it draws nothing. NodeLongPress gains the view's size, so a menu can keep to the part of the card that is on screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code asked only for Menlo, which Android doesn't have, so it fell back to the default sans. It now falls back to the system's monospace font. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Expo app gets an Android package name and keeps ios/ and android/ out of git (prebuild makes them). A long-press on a card opens the library's CanvasNodeMenu on Android, with Workspace's actions: copy text, open, copy and share a link, share a file. The buttons and the minimap keep inside the safe area, clear of Android's navigation bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
React Native Skia looked for React Native from its own folder, which in this npm workspace finds the hoisted copy the macOS example uses (0.81), not the Expo app's (0.88). Its native code then compiled against the wrong JSI headers and failed to link. The patch looks from the app first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…labels, links and file names These are drawn with fonts matched by the family name "System", which Android's font manager doesn't know: the font had no typeface and the text drew nothing. On Android the family is now "sans-serif"; elsewhere it is still "System". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…roid
Single-line text is drawn at one size and scaled by the camera. Hinted,
Android rounds each glyph's advance to a whole pixel at that size, so
zoomed in the letters drifted apart ("Render er"). Fonts for it now come
from one place, unhinted, with subpixel positions and linear metrics.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
iOS and macOS draw single-line labels with matchFont's font as before, so their widths, pills and centring are unchanged. Android keeps the unhinted, subpixel font with linear metrics. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The once-only guard on onDismiss now resets when press changes, so a host that keeps one instance and passes a new press is told when that menu closes. The lockfile records @expo/ui as the optional peer it is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lockfile resolves @expo/plist 0.10.1, which still builds parsed dicts with Object.create(null), so the 0.5.4 patch no longer applied and postinstall failed. Same one-line change, made against 0.10.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JSON Canvas on Android as on iOS: the example app runs on Android, text that drew nothing there now draws, and a card's long-press opens Material 3's menu.
Changes
Card menu on Android (
./menu, new entry point)CanvasNodeMenuis Compose'sDropdownMenuthrough Expo UI, anchored to the long-pressed card (press.frame). It opens below the card, or above it when there's no room below, lined up with the card's leading edge. A card that fills most of the view opens it at the finger. The card is outlined in the theme's primary colour while the menu is open. Items take a title, a Material Symbol icon and a destructive flag, with an optional label above them. A tap outside or Back closes the menu, andonDismissis called once per press, including when a host keeps one instance mounted. Off Android it draws nothing.@expo/ui, which is an optional peer: bare React Native consumers are unaffected.NodeLongPressgainsviewport(the view's size), so the menu keeps to the part of the card that is on screen.Renderer fixes for Android
"System", which Android's font manager doesn't know. Android now asks for"sans-serif".canvasFont), which on Android makes them unhinted, with subpixel positions and linear metrics. On iOS and macOS it returnsmatchFont's font unchanged, so Apple renders exactly as before.monospace.Example app
com.leslieoa.playground), andios/andandroid/are ignored because prebuild makes them.patches/react-native-skia+3.8.1.patch: Skia'sbuild.gradlelooked for React Native from its own folder. In this npm workspace that finds the hoisted 0.81 used by the macOS example, not the Expo app's 0.88, so Skia compiled against the wrong JSI headers and failed to link. The patch looks from the app (rootProject) first.overrideschoose versions, not where a package is installed. npm has no per-package nohoist, andinstall-strategy=nestedwould apply to the whole workspace, the macOS example included. The root can't move to 0.88 either, becausereact-native-macospins 0.81. The fault is Skia resolving React Native from its own location rather than the app's; the patch can go once Skia's build does that.Checked on a Samsung A15 (SM-A155F, Android 16, three-button navigation)
The debug build (arm64) was still running 15 s after launch, with
topResumedActivitythe playground. Every gesture was injected as real multi-pointer touch events and recorded withscreenrecord; the frames below come from those recordings.Gestures (recorded before the font fixes, so labels are missing here):


The card menu for a text card, a link and an image:



Labels before and after the font fix, then code and label spacing after:



npm test(216),npm run typecheckand the example'stscpass, and lint has no errors. iOS and macOS were not rebuilt for this PR. Their text draws as before: the family name stays"System"there, andcanvasFontapplies its settings only on Android.Still different from iOS
CanvasNodePreviewof the card. Android has no such preview in Material, so the card is outlined in place instead.Known limitation
🤖 Generated with Claude Code