Skip to content

Conversation

@PaulAllanSturm
Copy link
Collaborator

@PaulAllanSturm PaulAllanSturm commented Nov 17, 2025

In the "Sample Categories" view, we do some math to determine the width/height of each card. This was throwing an exception in "landscape" orientation. I think it was because we were trying to use constraints.maxHeight in the formula, which is considered "infinite" when inside a vertical scroll area. So the fix here is to just rely on constraints.maxWidth and calculate for exactly 4 columns.

Also I added a SafeArea so that the cards don't go under the system controls on the sides.

PR best viewed in "Settings > Hide whitespace" mode.

@PaulAllanSturm PaulAllanSturm self-assigned this Nov 17, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a crash in the "Sample Categories" view when displayed in landscape orientation. The crash occurred because the code was attempting to use constraints.maxHeight (which is infinite in a vertical scroll area) to calculate card dimensions. The fix ensures card sizing is based solely on constraints.maxWidth, using a 2-column layout in portrait and a 4-column layout in landscape, while also adding a SafeArea to prevent cards from appearing under system controls.

  • Replaced conditional logic with a switch expression for cleaner card size calculation
  • Changed landscape layout from 2 columns to 4 columns
  • Added SafeArea wrapper to prevent content overlap with system UI

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@PaulAllanSturm PaulAllanSturm merged commit 05efab2 into v.next Nov 20, 2025
1 check passed
@PaulAllanSturm PaulAllanSturm deleted the PaulAllanSturm/categoriesInLandscape branch November 20, 2025 18:51
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.

4 participants