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

TwoPaneView example does not render correctly in vertical orientation #39

Open
kmelmon opened this issue May 18, 2020 · 2 comments
Open
Labels
bug Something isn't working TwoPaneView

Comments

@kmelmon
Copy link
Contributor

kmelmon commented May 18, 2020

The TwoPaneView example app was designed for horizontal orientation (with panes left/right). If you turn the AutoRotate feature on in your Android device settings, then rotate the device to vertical orientation, the sample doesn't render correctly.

image

There are two problems here:

  1. Issue #TwoPaneView layout issue in vertical orientaiton #35
  2. There is an additional problem specific to this app, which this issue is tracking: The problem is that this app was designed with a "header" control (the orange bar across the top) which isn't part of the TwoPaneView. This control takes up layout space at the top of the window. So when you rotate the device vertical, the TwoPaneView control does its layout which is essentially like this:

Header => has fixed height
TwoPaneView => flexDirection: 'column'
--Pane1 => flex: 1
--Hinge => height: 34
--Pane2 => flex: 1

The problem here is that because the header control has taken some of the space at the top, the TwoPaneView cannot simply use flex:1 for the panes as this will result in the Hinge not landing in the correct place on screen. It will end up too far down.

This is an interesting problem! If you want a Header that goes all the way across the top in both horizontal and vertical orientations, this is a bit tricky to do with only one layout. I don't think TwoPaneView can do the math correctly - this is a well known problem of TwoPaneView not supporting full window layout.

@ghost ghost added the Needs: triage 🔍 label May 18, 2020
@kmelmon
Copy link
Contributor Author

kmelmon commented May 18, 2020

This is my suggestion on how to fix this:

In horizontal orientation, do what the code is currently doing. In vertical orientation, put the header into the top pane of the TwoPaneView (as a child of Pane1).

This will require having the app code listen to the dualscreeninfo event for orientation changes, and doing different layout depending on what the orientation is.

@chrisglein chrisglein added bug Something isn't working TwoPaneView and removed Needs: triage 🔍 labels Mar 31, 2021
@rectified95
Copy link
Collaborator

@aDavidaIsNoOne This looks related to what you've fixed recently with the hinge rect showing up on the screen -do you think this might already be fixed? (perhaps if you get a minute to verify this quickly, that'd be awesome)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working TwoPaneView
Projects
None yet
Development

No branches or pull requests

3 participants