Skip to content

Conversation

@jpancotti
Copy link

Previously using systemBackgroundColor, which could cause a visible flash of white or black background during tab transitions in apps with custom themes. Using clearColor ensures the background is transparent, preventing any visual artifacts regardless of the app's color scheme.

Fixes #3472

Description

When using NativeTabs with custom app themes (especially dark themes), there can be a brief flash of the system background color during tab transitions. Using clearColor makes the background fully transparent, preventing any flash regardless of the app's color scheme.

Changes

  • Changed self.backgroundColor from [UIColor systemBackgroundColor] to [UIColor clearColor] in RNSBottomTabsScreenComponentView.mm

Test code and steps to reproduce

import { Tabs } from 'expo-router/tabs';

export default function TabLayout() {
  return (
    <Tabs
      screenOptions={{
        tabBarStyle: { backgroundColor: '#1a1a2e' },
      }}
    >
      <Tabs.Screen name="index" options={{ title: 'Home' }} />
      <Tabs.Screen name="settings" options={{ title: 'Settings' }} />
    </Tabs>
  );
}
  1. Create app with dark theme
  2. Switch between screens rapidly
  3. Before: Brief flash of system background color visible around edges
  4. After: No flash, smooth transitions

Checklist

… transitions

Previously using systemBackgroundColor, which could cause a visible flash
of white or black background during tab transitions in apps with custom
themes. Using clearColor ensures the background is transparent, preventing
any visual artifacts regardless of the app's color scheme.
@kligarski
Copy link
Contributor

Hi, @jpancotti. Thank you for the PR.

Unfortunately, this is not as simple as it seems 😔. When you switch between tabs with similar color after tabs are rendered for the first time, there is another flash even with clearColor approach (for details see: #3492). Also, we added background color to tab screen to mitigate problems with liquid glass tab bar appearance adapting to the background (more details here: #3279). I'm not sure how it behaves with clearColor - this will require more testing.

We decided to expose in react-native-screens full configuration of background color (for host container and every tab screen) in this PR: #3492. This will allow you to modify background color as you like (including approach similar to this PR with tab screen being transparent).

As #3492 allows this configuration and more, I'll close this PR.

@kligarski kligarski closed this Dec 18, 2025
kligarski added a commit that referenced this pull request Jan 14, 2026
## Description

Adds customization of `backgroundColor` for native tabs container
(`UITabBarController.view` on iOS, `TabsHost` on Android) and tab screen
(`RNSBottomTabsScreenComponentView` on iOS, `TabScreen` on Android).

| Android | iOS |
| --- | --- |
| <video
src="https://github.com/user-attachments/assets/6dfb2628-560c-42d3-a380-6a858e7a8534"
/> | <video
src="https://github.com/user-attachments/assets/545dfcf3-7924-4c2d-ad7f-2ca00d369cb8"
/> |

Closes
software-mansion/react-native-screens-labs#721.
Supersedes
#3478.

### Comparison of different approaches to setting background color on
iOS

This PR allows for (at least) 3 kinds of setting background color in
tabs. Due to asynchronous nature, different approaches result in
different effect.

#### Tab screen + React View has background color

This is similar to current approach where tab screen uses
`systemBackgroundColor` and user defines background color via View
inside components passed to tab screen. This approach was used to
mitigate problems with liquid glass tab bar appearance adaptation (more
details:
#3279).


https://github.com/user-attachments/assets/49397de6-77d2-4d70-8412-6681fb361ee1

First, background color of tab screen is visible before tab's content is
rendered by React and correct color appears.

#### Only React View has background color

This is similar to approach suggested in
#3478
(transparent screen). While this seems to work better on first tab
renders, switching between similar tabs after they are rendered causes a
flash.


https://github.com/user-attachments/assets/816e59ad-6265-4c84-97c5-4ca64ca8341b

This is reproducible in bare UIKit app when child VC's view has clear
background color and its subview has different background color.

#### Only Tab screen has background color

This approach is possible thanks to this PR and it is closes to native
platform but tab's content still appears after a delay because it needs
to be rendered by React - this causes a flash on first render.


https://github.com/user-attachments/assets/8883acfe-d353-4f8c-90f7-462b46f4bf79

## Changes

- add `nativeContainerStyle` prop to `BottomTabs` component with
`backgroundColor` field
- add `style` prop to `BottomTabsScreen` component with
`backgroundColor` field
- add `Test3492`

## Test code and steps to reproduce

Run `Test3492`.

## Checklist

- [x] Included code example that can be used to test this change
- [x] Ensured that CI passes
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.

iOS 26: Custom Native-Stack Header Gets Rounded/Clipped During Navigation Transition

2 participants