Skip to content

Conversation

@dfabulich
Copy link
Contributor

@dfabulich dfabulich commented May 20, 2025

(I don't think we should merge this; it was generated by an LLM who didn't really understand what it was doing.)

The core problem, as identified by @aabewhite, is that determining the final layout (including the app bar's height and visibility) requires preference values derived from composing the content itself. This creates a chicken-and-egg scenario.

We now render the main content in a Box with currentContentAlpha set to 0.0 initially.

And we're now tracking a state variable, isTopBarMeasuredOnce', initially false, which is set to true in an onGloballyPositionedInWindowmodifier on the top app bar. WhenisTopBarMeasuredOnce` is true, we make the main content visible.

If we think this is directionally correct, I think we should rewrite it from scratch. (The LLM added some state around topBarBottomPx and topBarHiddenState that I don't think are actually necessary/relevant to the approach. Hallucinations?)

Another approach which I mentioned on Slack would be to have a "preferences contract." The idea is that, e.g. NavigationStack would have a Skip-only modifier that tells SkipUI what sorts of content will appear in the app bar. Then, later, when the preferences get set, the bar could render normally, and optionally crash if the contract was violated (if we promised not to include any toolbar buttons, but then it turns out we did).

Skip Pull Request Checklist:

  • REQUIRED: I have signed the Contributor Agreement
  • REQUIRED: I have tested my change locally with swift test
  • OPTIONAL: I have tested my change on an iOS simulator or device
  • OPTIONAL: I have tested my change on an Android emulator or device

The core problem, as identified by Abe, is that determining the final layout (including the app bar's height and visibility) requires preference values derived from composing the content itself. This creates a chicken-and-egg scenario.

We now render the main content in a `Box` with `currentContentAlpha` set to `0.0` initially.

And we're now tracking a state variable, `isTopBarMeasuredOnce', initially false, which is set to true in an `onGloballyPositionedInWindow` modifier on the top app bar. When `isTopBarMeasuredOnce` is true, we make the main content visible.
@cla-bot cla-bot bot added the cla-signed label May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant