Skip to content

[Bug]: AdaptiveTopBar (iOS): content top padding goes stale after device rotation #548

Description

@EEseka

Steps to Reproduce

Calf 0.14.0 (also 0.13.0), Compose Multiplatform 1.12.0, iOS.

  1. Build a screen with AdaptiveScaffold and an AdaptiveTopBar as its topBar.
  2. Launch the app with the device in portrait and open that screen.
  3. Rotate the device to landscape while staying on the screen.

Reverse case: open the screen in landscape, then rotate to portrait.

Expected Behavior

The scaffold's top content padding updates to the new native navigation bar height and safe-area inset
after rotation, so the content sits directly below the bar in both orientations.

Actual Behavior

The top padding keeps the value measured in the orientation the screen was opened in:

  • Portrait → landscape: content keeps the portrait padding, leaving a large gap below the status bar.
  • Landscape → portrait: the padding is too small, so content sits under the navigation bar.

Leaving the screen and coming back fixes it, because AdaptiveTopBar re-enters composition and measures again.

Cause: in navigation/AdaptiveTopBar.ios.kt, the height is measured in a LaunchedEffect(Unit) loop that
breaks once navBarHeightConsistencyCounter > 6 and is never restarted, so a rotation is never picked up.

Workaround: wrapping AdaptiveTopBar in key(LocalWindowInfo.current.containerSize) { ... } forces a
re-measure on rotation. A fix could restart the measurement when the view's size changes.

Module

calf-ui

Specify Other Module (if you selected "other" above)

No response

Platform

iOS

Library Version

latest

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions