Skip to content

Conversation

@kligarski
Copy link
Contributor

@kligarski kligarski commented Oct 27, 2025

Description

Adds experimental_userInterfaceStyle prop to RNSScreenStackHeaderConfig and RNSBottomTabsScreenComponentView. This allows enforcing light theme for navigation bars when device is in dark mode, preventing navigation bar flashes on iOS 26.

Important

Changes to react-navigation are required for this PR to work. To test the chagnes, apply the following patch:

Patch
diff --git a/packages/native-stack/src/types.tsx b/packages/native-stack/src/types.tsx
index c2c00d32d..fbdec1817 100644
--- a/packages/native-stack/src/types.tsx
+++ b/packages/native-stack/src/types.tsx
@@ -675,6 +675,15 @@ export type NativeStackNavigationOptions = {
    * @platform android
    */
   unstable_sheetFooter?: () => React.ReactNode;
+  /**
+   * Allows to override system appearance for the navigation bar.
+   *
+   * Does not support dynamic changes to the prop value for the currently visible screen.
+   *
+   * @default unspecified
+   * @platform ios
+   */
+  experimental_userInterfaceStyle?: ScreenStackHeaderConfigProps['experimental_userInterfaceStyle'];
 };
 
 export type NativeStackNavigatorProps = DefaultNavigatorOptions<
diff --git a/packages/native-stack/src/views/useHeaderConfigProps.tsx b/packages/native-stack/src/views/useHeaderConfigProps.tsx
index 74ff388d4..5df1ce1e7 100644
--- a/packages/native-stack/src/views/useHeaderConfigProps.tsx
+++ b/packages/native-stack/src/views/useHeaderConfigProps.tsx
@@ -49,6 +49,7 @@ export function useHeaderConfigProps({
   headerBack,
   route,
   title,
+  experimental_userInterfaceStyle,
 }: Props) {
   const { direction } = useLocale();
   const { colors, fonts } = useTheme();
@@ -302,6 +303,7 @@ export function useHeaderConfigProps({
     titleFontWeight: String(titleFontWeight),
     topInsetEnabled: headerTopInsetEnabled,
     translucent: translucent === true,
+    experimental_userInterfaceStyle,
     children,
   } as const;
 }
before after
theme_before.mov
theme_after.mov

Fixes #3162.

Changes

  • add experimental_userInterfaceStyle to RNSScreenStackHeaderConfig
  • add experimental_userInterfaceStyle to RNSBottomTabsScreenComponentView
  • use new props when navigating between screens

Test code and steps to reproduce

Run Test3342. Please note IMPORTANT section above.

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.

just naming remarks. Overall it looks good

@kligarski kligarski changed the title feat(iOS, Stack, Tabs, **unstable**): add prop to override user interface style feat(iOS, Stack, Tabs, **experimental**): add prop to override user interface style Nov 3, 2025
@kligarski kligarski requested a review from kkafar November 3, 2025 08:22
@kligarski kligarski force-pushed the @kligarski/navigation-bars-theme-override branch from 456200f to 312e01f Compare November 3, 2025 11:39
@kligarski kligarski force-pushed the @kligarski/navigation-bars-theme-override branch from 183056b to feb834c Compare November 6, 2025 08:34
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.

Hey, this looks good. I'd only ask if we can deduplicate the UserInterfaceStyle props.

Also naming a prop overrideUserInterfaceStyle suggests that this is a boolean. Maybe let's name it userInterfaceStyleOverride or just userInterfaceStyle? I know it's named like this in UIKit but imo id does not make sense. What do you think?

@kligarski kligarski requested a review from kkafar November 6, 2025 13:54
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.

Looks good. Thank you

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.

[Xcode 26] Theme is not applied everywhere when system is dark mode

4 participants