fix(appbar): prevent large/medium header title from being clipped on iOS#1
Closed
azizbecha wants to merge 1 commit into
Closed
fix(appbar): prevent large/medium header title from being clipped on iOS#1azizbecha wants to merge 1 commit into
azizbecha wants to merge 1 commit into
Conversation
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.
Owner
Author
|
Reopened against upstream: callstack#4941 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Appbar.Headerwithmode="large"(andmode="medium") renders its title clipped on iOS — the lower portion of the title text is cut off. Android is unaffected.mode="large")Root cause
In
medium/largemode,Appbarrenders acolumnContainer(flexDirection: 'column',flex: 1) holding acontrolsRowstacked overAppbarContent. The Appbar's content row usesalignItems: 'center', socolumnContaineris not stretched to the Appbar's fixedmodeAppbarHeight(large= 152,medium= 112) — it's sized to its content. The controls row plusAppbarContent'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, whereSurfacerenders a fixed-size layer (SurfaceIOS), that overflow is clipped; on Android it's a single view, so it spills instead of clipping.Fix
Add
alignSelf: 'stretch'tostyles.columnContainerso the column fills the header's fixed height inmedium/largemode. The controls row andAppbarContent(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— cleansmall/medium/large/center-aligned; confirm title fully visible & bottom-aligned in medium/large, and no Android regression). Marking as draft until that's confirmed. IfalignSelf: 'stretch'alone isn't sufficient, follow-ups would be: givecontrolsRowa fixed height instead offlex: 1, and/or rebalance thev3MediumContainer/v3LargeContainerpaddings inAppbarContent.tsx.Notes
tsccurrently fails onmainwith severalTS2698: Spread types may only be created from object typeserrors (ActivityIndicator,BottomNavigationBar,FABGroup,Menu,Modal,TouchableRipple.native) — looks like fallout from the RN 0.85StyleSheet.flattenunion typing. This PR's pre-commit hook was bypassed for that reason; that breakage should be fixed separately.