Skip to content

feat(android): native DuoGeometryView, Kotlin tests, and Android e2e - #31

Merged
CAWRESTLER merged 2 commits into
mainfrom
feat/android-geometry-view
Oct 8, 2026
Merged

CAWRESTLER merged 2 commits into
mainfrom
feat/android-geometry-view

Conversation

@CAWRESTLER

Copy link
Copy Markdown
Owner

Summary

Finishes the Android foldable support started in 0.1.0 and closes the Android gaps listed in its release notes.

Native DuoGeometryView on Android

  • On iOS, DuoGeometryView is already the native environment view wrapped around the content. Android now uses the same component (src/native/NativeDuoGeometryView.tsx), backed by the Android environment view from feat(android): foldable posture, fold regions, and fold-aware arrangements #27. Nested views see the fold in their own coordinates.
  • The view now also refreshes on ancestor scroll and global layout (ViewTreeObserver), because scrolling moves a view without re-laying it out. It reports only the system-bar insets that overlap the view, instead of the whole window's.
  • The API coverage row for Android reserved regions moves from Partial → Supported.

Kotlin unit tests

  • The pure conversions move into RNDuoFoldGeometry, which has no Android framework dependencies: hinge status, region kind, view-local frames, overlapping insets, and size classes. They have 8 JVM unit tests, and CI's Android job runs them.

Smaller fixes

  • @ReactProp on includeInactiveRegions silences the "Could not find generated setter" warning in logcat.
  • The provider's safeAreaInsets now cover only the system bars that overlap the provider.
  • ESLint ignores android/build/, where Gradle puts its HTML test report. Android test sources stay out of the npm package.
  • example/.gitignore now ignores only the generated /android/ and /ios/ folders, rather than every folder with those names, so .maestro/android/ is tracked.

Android end-to-end

  • example/.maestro/android/hinge.yaml plus yarn example e2e:android. The script sets the emulator's hinge angle with adb emu sensor set hinge-angle0 and checks the Hinge lab flat and half-open. It works on both wide (sidebar) and compact (menu) layouts.

Testing

  • Pixel Fold emulator (API 36): the Regions lab's DuoGeometryView reports 1 active division region at x −20, y −260, w 0, h 700, local to the card. Its y value tracks scrolling. yarn example e2e:android passes flat and half-open.
  • Clamshell foldable emulator ("6.7in Foldable"): the horizontal (tabletop) fold crosses the Regions card as an occlusion region, and DuoArrangementView stacks its panes above and below it.
  • Kotlin: 8/8 pass. yarn validate passes (77 Jest tests, 59 tooling tests, lint 0 errors, pack:check).

Emulator caveats

  • Rotating the Pixel Fold emulator left its fold state stuck mid-transition, so regions disappeared until a cold boot. This is emulator behavior; a cold-booted emulator reports regions correctly.
  • The clamshell profile never reports a fold posture (mDeviceState=UNKNOWN), so WindowManager keeps calling its fold flat even at 90°. The package deliberately trusts WindowManager's posture over the raw hinge sensor, so the clamshell shows "Fully open" there. The half-open posture was verified on the Pixel Fold. Physical foldable hardware is still untested.

🤖 Generated with Claude Code

- DuoGeometryView uses the native environment view on Android too, so
  nested views see the fold in their own coordinates. The view refreshes
  on ancestor scroll and global layout, and reports only the system-bar
  insets that overlap it.
- Pure conversions move to RNDuoFoldGeometry with JVM unit tests (hinge
  status, region kind, view-local frames, insets, size classes); CI's
  Android job runs them.
- @ReactProp on includeInactiveRegions silences "Could not find
  generated setter".
- Android Maestro flow plus `yarn example e2e:android`, which sets the
  emulator hinge angle and checks the Hinge lab flat and half-open.
- ESLint ignores android/build; Android test sources stay out of the
  npm package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CAWRESTLER
CAWRESTLER enabled auto-merge (squash) October 8, 2026 21:47
@CAWRESTLER
CAWRESTLER merged commit c0c5767 into main Oct 8, 2026
8 checks passed
@CAWRESTLER
CAWRESTLER deleted the feat/android-geometry-view branch October 8, 2026 22:06
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