Repository navigation
feat(android): foldable posture, fold regions, and fold-aware arrangements - #27
Merged
Merged
Conversation
- `@cawrestler/react-native-duo/jest`: components render with the JS fallbacks; setMockDuoEnvironment / resetMockDuoEnvironment / createMockDuoEnvironment simulate Duo environments and update mounted providers. Fallbacks moved to src/fallback/ so the mock imports them without platform resolution picking the native `.ios` files. - docs/API_STABILITY.md: proposed stable/experimental classification and open naming questions for 0.1.0; @experimental JSDoc tags on the proposed experimental exports. - example/.maestro: arrangement switching, toolbar rail placement, and scene accessory registration flows (`yarn example e2e`). Duo Lab toggles now give their switches an accessibility label. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ability # Conflicts: # CHANGELOG.md # src/DuoSceneAccessory.tsx
…ments - RNDuoEnvironmentView on Android reads Jetpack WindowManager's FoldingFeature and the hinge-angle sensor and emits the same environment payload as iOS: hinge status/angle, the fold as a division (or occlusion) reserved region, geometry, window metrics, and size classes. isDuo and supportsDuoApis stay false. - DuoProvider uses the shared native provider on iOS and Android; the store exposes the provider host so descendants can map provider-local region frames. - The fallback DuoArrangementView splits its panes along an active fold (resolveFoldSplit), honoring `axes` and the hinge thickness. Verified on a Pixel Fold emulator (API 36): Hinge lab reports "Partially open 90.0°" with the hinge detected, and the fold arrives as an active division region. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md # src/fallback/DuoArrangementView.tsx
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.
Summary
Adds real Android support for foldables (Pixel Fold, Galaxy Z Fold/Flip, and other devices Jetpack WindowManager supports). Before this, Android only got the JavaScript fallbacks.
Native (
android/)RNDuoEnvironmentViewand its view manager. They readFoldingFeaturethroughandroidx.window1.3.0 (WindowInfoTrackerCallbackAdapter), plus the hinge-angle sensor (TYPE_HINGE_ANGLE, API 30+). They emit the same environment payload as iOS:hinge.status:HALF_OPENED→partiallyOpen,FLAT→fullyOpen. When no fold is reported but there's a hinge sensor, the status comes from the angle, includingclosed.hinge.angleDegrees/angleRadianscome from the sensor.divisionreserved region (occlusionwhen the hinge hides content), active while it separates content, in provider-local dp.includeInactiveRegionsalso includes it while flat.isDuoandsupportsDuoApisstayfalse, since they describe iPhone Duo; foldable-aware code should checkhinge.available. Cameras and accessories still use the fallbacks.JavaScript
DuoProvider(src/native/NativeDuoProvider.tsx). Web keeps the fallback.DuoArrangementView(Android and web) splits along an active fold: side by side around a vertical fold, stacked around a tabletop fold. It leaves the hinge's thickness empty and respectsaxes. The geometry lives in a pureresolveFoldSplithelper with unit tests.Testing
adb emu sensor set hinge-angle0 90. The fold arrives as an active division region; the Duo Lab sidebar snaps to it. Unfolded flat, it correctly reports 0 active regions.yarn validatepasses: 77 Jest tests including the newfold-split.test.tsx, 59 tooling tests, lint with 0 errors, andpack:check.Could not find generated setterwarning; Fabric props go through the codegen delegate.🤖 Generated with Claude Code