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

Device info on dual-screen #189

Open
YuliKl opened this issue Jan 17, 2020 · 7 comments
Open

Device info on dual-screen #189

YuliKl opened this issue Jan 17, 2020 · 7 comments
Labels
🗣 Discussion This label identifies an ongoing discussion on a subject

Comments

@YuliKl
Copy link

YuliKl commented Jan 17, 2020

Introduction

Foldable devices is a growing area of innovation. Microsoft will be entering with market with the Surface Neo and the Surface Duo, which run Windows and Android operating systems, respectively. Microsoft has started publishing some information about dual-screen development, and there's a great opportunity here for React Native to bridge the gap and enable cross-platform app development.

The Core of It

With dual-screen devices come new challenges for apps to provide a great user experience. One challenge is correctly handing content spanned across two screens. To avoid awkwardly placing content in a location where the user can't easily see or interact with it, apps and components would benefit from information such as:

  • How many screens does the device have?
  • Is the app currently spanned across more than one screen?
  • Where is the location of the gap between screens?

Modules

We propose creating native modules for Android and Windows, and encapsulating their information in a JS DualScreenInfo module, which will include the following information

API Description Type
isDualScreenDevice Returns True if the app is running on a dual screen device boolean
isSpanning Returns True if the current app is spanned across both screens of a dual screen device boolean
windowRects Returns a collection of rects representing the usable area of the app window WindowRect[]
hingeWidth The measurement, in DPs, between the closest edges of the window rects number
addEventListener type can take the value { spannedChanged, windowRectsChanged } DualScreenInfoEvent
removeEventListener DualScreenInfoEvent

Discussion points

@YuliKl
Copy link
Author

YuliKl commented Jan 17, 2020

@kmelmon FYI

@kmelmon
Copy link

kmelmon commented Jan 17, 2020

The folks on the web browser side of things are working on the same issue. This might help folks understand what kind of information we're talking about exposing;
https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/Foldables/explainer.md

@hramos hramos added the 🗣 Discussion This label identifies an ongoing discussion on a subject label Jan 17, 2020
@YuliKl YuliKl changed the title RN apps on dual-screen devices Device info on dual-screen Jan 19, 2020
@chrisglein
Copy link
Collaborator

Preview SDK for the Surface Duo and more overall information here: https://blogs.windows.com/windowsdeveloper/2020/01/22/announcing-dual-screen-preview-sdks-and-microsoft-365-developer-day/

@shergin
Copy link

shergin commented Jan 30, 2020

I am a huge fan of dual/multiple-screen future of computing. Thank you for working on this!

I am curious, should the API be intrinsically focused on dual-screen setup, or we should try to build it more generically (e.g. specifying a list of screen and list of characteristics that "connect" those screens)?

@shergin
Copy link

shergin commented Jan 30, 2020

Another concern is sync vs. async APIs design.
Seems that those constrains (screen setup) can change in-flight, so the API should be able to deliver some event on the main thread synchronously and reconcile React state and relayout synchronously. This is maybe not so important for now (because classic RN is async) but with Fabric adoption, it will become crucial to deliver the best possible UX.

@framerate
Copy link

@YuliKl hi! If I were to developer a new dual screen device, how would I set it up so this package returns isDualScreenDevice: true ?

I'd love to enhance this package, but currently I'm seeing false...

@victorglezcardoso
Copy link

victorglezcardoso commented Oct 25, 2023

Hi there, somebody can tell me if I can use this package with expo dev-client.

I tried by I got this error java.lang.NoSuchMethodError: No static method systemBars()I in class Landroid/view/WindowInsets$Type; or its super classes (declaration of 'android.view.WindowInsets$Type' appears in /system/framework/framework.jar!classes3.dex)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗣 Discussion This label identifies an ongoing discussion on a subject
Projects
None yet
Development

No branches or pull requests

7 participants