Skip to content

Commit

Permalink
fix: correctly set header to translucent
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Feb 3, 2022
1 parent 29b501f commit c9eed38
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/native-stack/src/views/HeaderConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ export default function HeaderConfig({
? headerLeftElement != null
: Platform.OS === 'android' && headerTitleElement != null;

const translucent =
headerBackground != null ||
headerTransparent ||
// When using a SearchBar or large title, the header needs to be translucent for it to work on iOS
((hasHeaderSearchBar || headerLargeTitle) &&
Platform.OS === 'ios' &&
headerTransparent !== false);

return (
<>
{headerBackground != null ? (
Expand Down Expand Up @@ -186,13 +194,8 @@ export default function HeaderConfig({
titleFontWeight={titleFontWeight}
topInsetEnabled={insets.top !== 0}
translucent={
headerBackground != null ||
// This defaults to `true`, so we can't pass `undefined`
headerTransparent === true ||
// When using a SearchBar or large title, the header needs to be translucent for it to work on iOS
((hasHeaderSearchBar || headerLargeTitle) &&
Platform.OS === 'ios' &&
headerTransparent !== false)
translucent === true
}
>
{Platform.OS === 'ios' ? (
Expand Down

0 comments on commit c9eed38

Please sign in to comment.