Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for transparent large header on iOS #2501

Conversation

EvanBacon
Copy link
Contributor

@EvanBacon EvanBacon commented Nov 13, 2024

Description

  • requires this bug fix fix(iOS): add missing largeTitleBackgroundColor prop #2500
  • make it possible to support the stock Apple behavior where the large header is transparent and the collapsed header is blurry with a shadow. This is currently not possible because we inherit the blur effect from the collapsed title, and because there's no way to set the headerLargeTitle blur effect.

With this change, the default iOS behavior can more closely be matched by using the following props:

{
  headerLargeTitle: true,
  headerTransparent: true,
  headerBlurEffect: "systemChromeMaterial",
  headerLargeTitleShadowVisible: false,
  headerShadowVisible: true,
  headerLargeStyle: {
    // NEW: Make the large title transparent to match the background.
    backgroundColor: "transparent",
  },
}

Without the shadow changes, users also need to add this (and adjust for dark mode):

{
  headerStyle: {
    // Hack to ensure the collapsed small header shows the shadow / border.
    backgroundColor: "rgba(255,255,255,0.01)",
  },
}

Changes

Before

This is the best we can currently do.

IMG_5976

After

Simulator.Screen.Recording.-.iPhone.16.Pro.Max.-.2024-11-13.at.14.15.39.mp4

Test code and steps to reproduce

Checklist

Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

I have one question that needs to be answered before we can proceed.

ios/RNSScreenStackHeaderConfig.mm Outdated Show resolved Hide resolved
@kkafar kkafar self-requested a review November 14, 2024 14:58
Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version makes more sense, thanks!

@kkafar kkafar changed the title add support for transparent large header on iOS to obtain the default Apple behavior feat: add support for transparent large header on iOS Nov 14, 2024
@kkafar kkafar merged commit 40f318a into software-mansion:main Nov 14, 2024
5 checks passed
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