Skip to content

DualScreenInfo & TwoPaneView could be re-based on Jetpack Window Manager for broader compatibility #107

@conceptdev

Description

@conceptdev

The DualScreenInfo and TwoPaneView describe functional specs for behavior on a dual-screen device like Surface Duo.

The original implementation was done using a Microsoft-provided DisplayMask package, which only works on Surface Duo.

Jetpack Window Manager

Google has been working on a more generic library for dual-screen and foldable devices - Jetpack Window Manager - which provides similar functionality to DisplayMask (ie. reports on application layout changes that include interaction with a hinge/fold on the device). It recently (September 2021) reached beta status, which generally indicates a stable API shape.

Updating react-native-dualscreen to use Window Manager instead of DisplayMask would mean React Native apps would be able to detect and adapt to dual-screen and foldable devices from other manufacturers that support Google's API (eg. Samsung Galaxy Fold and Flip).

Implementation

The existing DualScreenInfo.kt code is relatively self-contained because DisplayMask is an on-demand style API. Jetpack Window Manager is event driven and should be 'set up' early in the application lifecycle - see this blog and docs.

Broadly speaking the same data is available (screen and hinge/fold coordinates, which can be used to pass visible Rect values to the app). Other cross-platform frameworks are also doing this migration for Surface Duo and other device support: Xamarin, Flutter, Unity, Uno.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions