Edge fades, backdrop blur, and masks that render natively on iOS and Android and with CSS on web
Three visual effects under One.UI, each drawn by the platform’s own
graphics stack:
EdgeFade fades content out toward one or more edges, the way a list
dissolves under a header. It can fade to transparent, paint a color over
the edge, or blur the content progressively.Blur blurs whatever is behind it, like a frosted toolbar, while its
own children stay sharp.Mask shows its children only where another element is opaque, for
gradient text or shaped images.import { One } from 'one'
function Feed() { return ( <One.UI.EdgeFade top={48} bottom={64} style={{ flex: 1 }}> <Posts /> </One.UI.EdgeFade> )}Both edges fade to transparent along the default smooth curve, so whatever
is behind the feed shows through.
EdgeFade picks one of three modes. mask fades the content’s alpha,
overlay paints a color gradient over it, and blur blurs it more toward
the edge. Without mode, it is overlay when any edge has a color and
mask otherwise; blur must be asked for.
backgroundImage gradients over the children, with the curve
sampled into color stops.UIVisualEffectView clipped to its edge strip, so the interior costs
nothing; on Android each is a RenderEffect blur of a recording of the
children, on Android 12 and later.Presets reach native code by name and use cached gradients there; a bezier
or stop list is sampled in JavaScript and sent as alpha values. On web every
mode is plain elements: mask and overlay use CSS gradients, and blur puts a
backdrop-filter strip on each edge with its own gradient mask.
Blur on iOS is a UIVisualEffectView with the chosen material. UIKit has
no blur intensity, so the component holds a paused animator at the intensity
point, and rebuilds it when UIKit could have reset it: on return from the
background and when entering a window. On Android 12 and later it records
what is drawn behind the view and applies a Gaussian RenderEffect to that
recording, then draws a tint over it; children draw on top, sharp. On web it
is a CSS backdrop-filter blur of up to 20 pixels with a tinted veil.
Mask mounts maskElement as an invisible first child. On iOS its layer
becomes the view’s layer mask, which Core Animation renders live. On Android
the mask subtree is drawn into a reused bitmap, redrawn only when it changes,
and applied as an alpha mask. On web the mask subtree is serialized with its
computed styles into an SVG image used as a CSS mask-image.
| One.UI.Blur | Type | Description |
|---|---|---|
intensitynumber = 50Blur strength from 0 to 100. Values outside that range are clamped. | number = 50 | Blur strength from 0 to 100. Values outside that range are clamped. |
tintBlurTint = "default"Native material name. Web approximates its tint with a frost veil. | BlurTint = "default" | Native material name. Web approximates its tint with a frost veil. |
styleStyleProp<ViewStyle>Container layout and styling. Give the effect explicit bounds. | StyleProp<ViewStyle> | Container layout and styling. Give the effect explicit bounds. |
BlurTint is light, dark, default, extraLight, regular,
prominent, or one of the system materials systemUltraThinMaterial,
systemThinMaterial, systemMaterial, systemThickMaterial, and
systemChromeMaterial, each also with a Light or Dark suffix.
| One.UI.EdgeFade | Type | Description |
|---|---|---|
topboolean | number | EdgeConfigFade at the top edge. | boolean | number | EdgeConfig | Fade at the top edge. |
bottomboolean | number | EdgeConfigFade at the bottom edge. | boolean | number | EdgeConfig | Fade at the bottom edge. |
leftboolean | number | EdgeConfigFade at the left edge. | boolean | number | EdgeConfig | Fade at the left edge. |
rightboolean | number | EdgeConfigFade at the right edge. | boolean | number | EdgeConfig | Fade at the right edge. |
startboolean | number | EdgeConfigLeading edge for the current layout direction. Overrides its physical edge. | boolean | number | EdgeConfig | Leading edge for the current layout direction. Overrides its physical edge. |
endboolean | number | EdgeConfigTrailing edge for the current layout direction. Overrides its physical edge. | boolean | number | EdgeConfig | Trailing edge for the current layout direction. Overrides its physical edge. |
sizenumber = 80Default enabled-edge depth in dp. | number = 80 | Default enabled-edge depth in dp. |
curveEdgeFadeCurve = "smooth"Default alpha or blur-envelope curve. | EdgeFadeCurve = "smooth" | Default alpha or blur-envelope curve. |
modeEdgeFadeModemask fades alpha; overlay paints color; blur softens edge content. Defaults to overlay when any edge has a color, otherwise mask. | EdgeFadeMode | mask fades alpha; overlay paints color; blur softens edge content. Defaults to overlay when any edge has a color, otherwise mask. |
colorColorValueOverlay color, or an optional frost veil in blur mode. Ignored in mask mode. | ColorValue | Overlay color, or an optional frost veil in blur mode. Ignored in mask mode. |
blurRadiusnumber = 28Maximum blur radius in dp for blur mode. Clamped to zero or greater. | number = 28 | Maximum blur radius in dp for blur mode. Clamped to zero or greater. |
frostProgressionnumber = 1Fraction of the edge band over which blur reaches full strength. Clamped from 0.05 to 1. | number = 1 | Fraction of the edge band over which blur reaches full strength. Clamped from 0.05 to 1. |
radiusnumberCorner radius shared by the fade and clipping. Use this instead of style.borderRadius. | number | Corner radius shared by the fade and clipping. Use this instead of style.borderRadius. |
styleStyleProp<ViewStyle>Container layout and styling; borderRadius is ignored with a development warning. | StyleProp<ViewStyle> | Container layout and styling; borderRadius is ignored with a development warning. |
An edge takes true to use size, a number for its own depth, or an
EdgeConfig. start and end follow the layout direction and win over
left and right.
| EdgeConfig | Type | Description |
|---|---|---|
sizenumberOverride the component fade depth for this edge. | number | Override the component fade depth for this edge. |
curveEdgeFadeCurveOverride the component curve for this edge. | EdgeFadeCurve | Override the component curve for this edge. |
colorColorValueOverride the overlay color for this edge. Ignored in blur and mask modes. | ColorValue | Override the overlay color for this edge. Ignored in blur and mask modes. |
An EdgeFadeCurve is a preset (smooth, smoother, sharp, gentle,
soft, linear), a cubic bezier, or a list of alpha stops from the inner
edge to the outer edge.
| CubicBezierCurve | Type | Description |
|---|---|---|
type (required)"cubicBezier"Select the cubic bezier curve. | "cubicBezier" | Select the cubic bezier curve. |
x1 (required)numberFirst control point x coordinate. | number | First control point x coordinate. |
y1 (required)numberFirst control point y coordinate. | number | First control point y coordinate. |
x2 (required)numberSecond control point x coordinate. | number | Second control point x coordinate. |
y2 (required)numberSecond control point y coordinate. | number | Second control point y coordinate. |
| StopsCurve | Type | Description |
|---|---|---|
type (required)"stops"Select an alpha-stop list. | "stops" | Select an alpha-stop list. |
values (required)[number, number, ...number[]]At least two alpha values, ordered from the inner edge to the outer edge. | [number, number, ...number[]] | At least two alpha values, ordered from the inner edge to the outer edge. |
| One.UI.Mask | Type | Description |
|---|---|---|
maskElementReactNodeThe offscreen mask element. Opaque pixels show children; transparent pixels hide them. | ReactNode | The offscreen mask element. Opaque pixels show children; transparent pixels hide them. |
styleStyleProp<ViewStyle>Container layout and styling. | StyleProp<ViewStyle> | Container layout and styling. |
One.UI.sampleCurve(curve) returns the inner to outer alpha values: 32
samples for a preset or bezier, rounded to four places, or the stop list
clamped to 0 through 1. One.UI.serializeCurve(curve) returns a preset’s
name, or the samples joined with commas.
| iOS | Android | Web | |
|---|---|---|---|
| Blur | UIKit material | RenderEffect, Android 12 | CSS backdrop filter |
| Blur before Android 12 | Tint only, no blur | ||
| Edge fade blur mode | Effect views per edge | Android 12; mask mode before | Backdrop filter strips |
| Mask | Live layer mask | Bitmap, redrawn on change | CSS mask image |
radius, not borderRadius, on EdgeFade. The fade and the clip
share radius; style.borderRadius is ignored, with a warning in
development.Blur draws only its tint, and
EdgeFade’s blur mode falls back to a mask fade.color is
an optional frost veil, and each edge’s own color is ignored.maskElement
that is not an element warns once and renders the children unmasked.import { ScrollView, Text, View } from 'react-native'import { One } from 'one'
function Screen() { return ( <View style={{ flex: 1 }}> <ScrollView contentContainerStyle={{ paddingTop: 96 }}> <Posts /> </ScrollView> <One.UI.Blur tint="systemChromeMaterial" style={{ position: 'absolute', top: 0, left: 0, right: 0, height: 96, justifyContent: 'flex-end', padding: 16 }} > <Text style={{ fontSize: 28, fontWeight: '700' }}>Feed</Text> </One.UI.Blur> </View> )}The list scrolls under the header and shows through it blurred, while the title stays sharp. The top padding keeps the first post clear of the header at rest.
import { ScrollView } from 'react-native'import { One } from 'one'
function Chips() { return ( <One.UI.EdgeFade end={{ size: 32, color: '#ffffff' }} style={{ height: 44 }}> <ScrollView horizontal showsHorizontalScrollIndicator={false}> <ChipRow /> </ScrollView> </One.UI.EdgeFade> )}A color makes this overlay mode, which paints white over the trailing edge.
end flips to the left side in right to left layouts.
import { Text, View } from 'react-native'import { One } from 'one'
function Title() { return ( <One.UI.Mask maskElement={<Text style={{ fontSize: 40, fontWeight: '800' }}>One</Text>}> <View style={{ height: 48, width: 120, backgroundImage: 'linear-gradient(to right, #ff5f6d, #ffc371)' }} /> </One.UI.Mask> )}The text is the mask, so the gradient view shows only inside the letters.
The ordinary iOS blur is adapted from react-native-blur by Ahmed Sbai. The EdgeFade native masks and blur are adapted from react-native-edge-fade by Giulio Amato.
Edit this page on GitHub.