Skip to content

fix(appbar): prevent large/medium header title from being clipped on iOS#4941

Draft
azizbecha wants to merge 1 commit into
callstack:mainfrom
azizbecha:fix/appbar-large-mode-title-clipped-ios
Draft

fix(appbar): prevent large/medium header title from being clipped on iOS#4941
azizbecha wants to merge 1 commit into
callstack:mainfrom
azizbecha:fix/appbar-large-mode-title-clipped-ios

Conversation

@azizbecha
Copy link
Copy Markdown
Collaborator

Summary

Appbar.Header with mode="large" (and mode="medium") renders its title clipped on iOS — the lower portion of the title text is cut off, and it sits too high in the header instead of being bottom-aligned. Android is unaffected.

Root cause

In medium/large mode, Appbar renders a columnContainer (flexDirection: 'column', flex: 1) holding a controlsRow stacked over AppbarContent. The Appbar's content row uses alignItems: 'center', so columnContainer is not stretched to the Appbar's fixed modeAppbarHeight (large = 152, medium = 112) — it's sized to its content. The controls row plus AppbarContent's mode padding (v3LargeContainer: paddingTop: 36 + paddingBottom: 28; v3MediumContainer: paddingBottom: 24) plus the headline line-height can exceed the header height, so the title overflows the Appbar's bounds. On iOS, where Surface renders a fixed-size layer (SurfaceIOS), that overflow is clipped; on Android it's a single view, so it spills instead of clipping (less visible).

Fix

Add alignSelf: 'stretch' to styles.columnContainer so the column fills the header's fixed height in medium/large mode. The controls row and AppbarContent (justifyContent: 'flex-end') then partition a known height and the title stays within bounds.

 columnContainer: {
   flexDirection: 'column',
   flex: 1,
+  alignSelf: 'stretch',
   paddingTop: 8,
 },

Testing

  • yarn jest src/components/__tests__/Appbar — 37 passed, 2 snapshots passed (no snapshot churn)
  • yarn eslint src/components/Appbar/Appbar.tsx — clean
  • ⚠️ Marked draft pending manual verification on an iOS simulator (example app → Appbar screen → cycle small/medium/large/center-aligned; confirm the title is fully visible and bottom-aligned in medium/large, and there's no Android regression). If alignSelf: 'stretch' alone isn't sufficient, follow-ups would be giving controlsRow a fixed height instead of flex: 1, and/or rebalancing the v3MediumContainer / v3LargeContainer paddings in AppbarContent.tsx.

In `medium`/`large` mode the inner column was sized to its content rather
than to the Appbar's fixed `modeAppbarHeight`, so the controls row plus the
title's padding/line-height could exceed the header height. On iOS, where
`Surface` renders a fixed-size layer, the overflowing title got clipped.

Add `alignSelf: 'stretch'` to `columnContainer` so it fills the header
height; the controls row and `AppbarContent` (`justifyContent: 'flex-end'`)
then partition that known height and the title stays within bounds.
@callstack-bot
Copy link
Copy Markdown

Hey @azizbecha, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

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.

2 participants