useScreenOptions hook provides a convenient way to generate React Navigation screen options that automatically adapt to the current theme and platform. It returns a configuration object optimized for native feel with blur effects on iOS and solid backgrounds on Android and web.
Usage
Parameters
Controls whether the header should be transparent. When
true, the header will use blur effects (on iOS) or transparent backgrounds. When false, the header will have a solid background color.Return Value
Returns aNativeStackNavigationOptions object with the following properties:
Aligns the header title to the center of the navigation bar.
Controls header transparency. Set to the value of the
transparent parameter (defaults to true).The blur effect style for iOS headers. Automatically set to
"dark" in dark mode and "light" in light mode.The color for header text and icons. Automatically set to
theme.text to match the current theme.Platform-specific header background styles:
- iOS:
undefined(allows blur effect to show through) - Android:
theme.backgroundRoot(solid background) - Web:
theme.backgroundRoot(solid background)
Enables swipe-back gesture navigation. Always set to
true.Sets the direction of swipe gestures to horizontal (left-to-right for back navigation).
Controls full-screen gesture support. Automatically disabled when liquid glass effect is available, enabled otherwise.
Styles for the screen content container. Sets
backgroundColor to theme.backgroundRoot for consistent theming.Platform-Specific Behavior
- iOS
- Android
- Web
On iOS, the hook creates a native-feeling navigation experience with:
- Transparent headers with blur effects that adapt to light/dark mode
- Centered titles matching iOS design guidelines
- Swipe-back gestures enabled for natural navigation
- Theme-aware tint colors for navigation elements
Examples
Basic Stack Navigator
Solid Header Background
Mixed Screen Options
Custom Screen Options with Base
Per-Screen Dynamic Options
Nested Navigators
When to Use
Stack Navigators
Use for all stack navigators to ensure consistent, theme-aware navigation headers across your app.
Platform Optimization
Automatically handles platform-specific optimizations like iOS blur effects and Android solid backgrounds.
Theme Integration
Ensures navigation elements update automatically when the user switches between light and dark mode.
Native Feel
Provides gestures and visual effects that feel native on each platform without manual configuration.
Best Practices
Use at Navigator Level
Use at Navigator Level
Override When Needed
Override When Needed
Individual screens can override specific options while preserving the base configuration:
Transparent vs. Solid Headers
Transparent vs. Solid Headers
Use transparent headers for content that scrolls under the header (like lists), and solid headers for static content:
Consider Liquid Glass Effect
Consider Liquid Glass Effect
The hook automatically disables full-screen gestures when the liquid glass effect is available to prevent gesture conflicts:This is handled automatically, but be aware when designing gesture-heavy interfaces.
The hook uses
useTheme internally, so the navigation options automatically update when the system color scheme changes. You don’t need to manually handle theme updates.Related Hooks
useTheme
Access theme colors and dark mode state (used internally by useScreenOptions)
useColorScheme
Get the raw color scheme value