DocsHooks & utilities
useReduceTransparency
Tracks the iOS Reduce Transparency setting, so glass and blur can fall back to solid colours.
Tracks the iOS Reduce Transparency setting, so glass and blur surfaces can fall back to solid colours.
Free (MIT)Version 1.0.0Released 23 Oct 2026iOS and Android
When to use it
- Choose a solid surface when the user requests reduced transparency.
When not to use it
- Use motion preferences separately; reduced transparency does not mean reduced motion.
Installation
Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.
npx @swipeui/cli add use-reduce-transparency- Adds
components/swipeui/hooks/use-reduce-transparency.ts.
Usage
import { useReduceTransparency } from '@/components/swipeui/hooks/use-reduce-transparency';
const reduceTransparency = useReduceTransparency();
const glass = Platform.OS === 'ios' && glassAvailable && !reduceTransparency;
// glass: a tinted glass view; otherwise a solid bg-surface-elevated background.It reads the setting on mount and updates while the app runs.
Gotchas
- It's always
falseon Android, which has no such setting. - It returns
falseuntil the first read completes, a moment after mount.
Accessibility
- Respect the iOS accessibility preference and provide a solid surface.
Motion
- Static on its own; any movement comes from the parent that animates it.
- No custom movement is configured by this item.
Performance
- Subscribes to the accessibility setting and removes the listener on unmount.
Notes for AI
- Use this hook for blur/glass fallbacks, not to detect Liquid Glass availability.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.