Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
conceptdev opened this issue Sep 8, 2021 · 0 comments
Labels
enhancement New feature or request Platform: Android

Comments

@conceptdev
Copy link
Member

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.

@ghost ghost added the Needs: triage 🔍 label Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Platform: Android
Projects
None yet
Development

No branches or pull requests

2 participants