This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
MaskedView
A masked view compatible with @react-native-masked-view/masked-view.
A MaskedView component with an API compatible with @react-native-masked-view/masked-view. The opaque pixels of maskElement reveal the masked content behind it; transparent pixels hide it.
Under the hood this component bridges arbitrary React Native children into the platform-specific @expo/ui masking primitives:
- Android: Jetpack Compose graphics layer compositing with
BlendMode.DstIn. - iOS: SwiftUI
.maskmodifier.
Installation
If you are installing this in an existing React Native app, make sure to install expo in your project.
Migrating from @react-native-masked-view/masked-view
- Update the import from
import MaskedView from '@react-native-masked-view/masked-view'toimport { MaskedView } from '@expo/ui/community/masked-view'. - The
androidRenderingModeprop is not supported. The Compose-based implementation always uses an offscreen graphics layer, so the prop has no equivalent and is omitted from the public types. - Web is not implemented. On web, children render unmasked and a one-time console warning is logged. For web targets, prefer the CSS primitive that fits your specific case:
- Gradient text —
background-clip: textwithcolor: 'transparent'and a CSS gradient/image as the background. - Alpha fade —
mask-image: linear-gradient(...)(orWebkitMaskImage) directly on the content view. - Shape mask (circle, rounded rectangle, and so on) —
clip-path: circle(...)/inset(...)/path(...), orborder-radius+overflow: 'hidden'.
- Gradient text —
Basic usage
Alpha-fade mask
Only the alpha channel of the maskElement matters: opaque pixels reveal content, transparent pixels hide it. Use a LinearGradient (from expo-linear-gradient) that goes from opaque to transparent — 'black' (for example) to 'transparent' below — to fade content out along an axis.
API
import { MaskedView } from '@expo/ui/community/masked-view';
Component
Type: React.Element<MaskedViewProps>
Renders children with the alpha channel of maskElement applied as a mask:
opaque pixels of maskElement reveal children, transparent pixels hide them.
API-compatible with @react-native-masked-view/masked-view.
Drop-in props for @react-native-masked-view/masked-view's MaskedView.