Glass Engine

The Liquid Glass engine is the rendering heart of Reactnatively. It manages blur surfaces, elevation depth, tint overlays, and edge highlights — adapting automatically to platform capability and device power state.

Architecture

Every glass surface is composed of five rendering layers, stacked bottom-to-top:

1
Shadow shellDrop shadow / elevation (no overflow:hidden)
2
Clip shellClips all glass layers to border radius
3
BlurViewNative platform blur via expo-blur
4
Tint overlaySemi-transparent color layer
5
HighlightTop-edge refraction shimmer (LinearGradient)
6
Border ring1px glass edge line
7
ContentChildren, above all glass layers

Elevation system

The elevation system maps a single integer (0–5) to a complete glass rendering recipe — blur intensity, tint opacity, shadow, and more:

ElevationBlurTint OpacityShadowUse case
000.95noneFlat / opaque background
1120.82subtleSubtle surface card
2240.72lightStandard card (default)
3360.65mediumFloating panel
4520.58heavyModal / sheet
5720.50deepTop-level overlay

Capability detection

The engine auto-detects platform capability and adjusts rendering accordingly:

typescript
import {
  GLASS_CAPABILITY,
  SUPPORTS_BLUR,
  IS_FULL_GLASS,
  IS_PARTIAL_GLASS,
  IS_NO_GLASS,
} from 'reactnatively/glass';

// Capability values
// FULL_GLASS  — iOS with expo-blur (best)
// PARTIAL_GLASS — Android with BlurView (good)
// NO_GLASS   — fallback: solid tint only

console.log(GLASS_CAPABILITY); // 'FULL_GLASS' | 'PARTIAL_GLASS' | 'NO_GLASS'
console.log(SUPPORTS_BLUR);    // true | false

Render budget

Use GlassPlatformProvider to set a global blur surface limit:

tsx
import { GlassPlatformProvider } from 'reactnatively/glass';

export function App() {
  return (
    <GlassPlatformProvider
      material={{
        quality: 'balanced',
        powerMode: 'auto',
      }}
      budget={{
        maxBlurSurfaces: 8,
      }}
    >
      <YourApp />
    </GlassPlatformProvider>
  );
}