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

Supported landscape orientation (Android) #706

Merged
merged 12 commits into from
Jun 17, 2023
Merged

Conversation

grahammendick
Copy link
Owner

Fixes #690

Added landscape prop to Scene on Android. On iOS can only change orientation in full screen Modals (see Apple's UIKit video at 23:20).

<Scene stateKey="timeline" landscape><Timeline /></Scene>

Followed existing pattern for backgroundColor, hidesTabBar etc. These props exist on both the NavigationStack (for global setting and for non-component api) and the Scene
Navigate from A --> B --> C with both B and C in landscape, then going back to B goes to portrait (unspecified). The getAnimation was returning null because the crumb was less than the current crumbs so it went back to default orientation.
Changed to use the navigationEvent from state because that doesn't change when navigating - that's fixed for current scene. It's not guaranteed to be there, for example, fluent navigation, so used the navigationEvent from props if the one from state isn't there
Think this covers 99% of usecases because only ever want to change to landscape. Nobody wants upside down portrait, for example. Also think only want landscape that works no matter what direction user's phone is in - ltor or rtol - so went with user_landscape so automatically handled
Think the simulator behaves oddly so can't be 100% it's correct. There's interface orientation and device orientation. When rotating the simulator that changes both of these. When programmatically changing the orientation it also seems to change both but without rotating the simulator. So it's hard to know what position the 'real' device is in. But assuming that the device orientation is reliable indicator of its position. So when changing to landscape programmatically the device is actually rotated (even though simulator isn't). Basically can't replicate orientation landscape but device portrait in simulator
Also typed the sharedElements prop on scene (it was only on the stack)
@grahammendick grahammendick merged commit 49f7905 into master Jun 17, 2023
@grahammendick grahammendick deleted the scene-orientation branch June 17, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant