@callstack/liquid-glass

中文文档
0.8.2发布于 2026/09/16MITTypeScriptCommonJS零依赖近 30 天下载 67.5万

Liquid Glass in React Native

原始使用文档
文档目录8 节
  1. Features
  2. Documentation
  3. Installation
  4. Usage
  5. API
  6. LiquidGlassView - Props
  7. LiquidGlassContainerView - Props
  8. Made with ❤️ at Callstack

React Native Liquid Glass 🔍

mit licence npm version npm downloads npm downloads

@callstack/liquid-glass brings iOS 26 liquid glass effect to React Native apps on iOS.

https://github.com/user-attachments/assets/44c18136-8760-49f2-ae16-62557c3ae2e1

Features

  • ✨ iOS 26 liquid glass visual effect
  • 🎨 Customizable tint colors
  • 🔧 Two effect modes: clear and regular

Documentation

Installation

npm install @callstack/liquid-glass
# or
yarn add @callstack/liquid-glass

[!WARNING] Make sure to compile your app with Xcode >= 26. React Native 0.80+ is required.

[!WARNING] This library is not supported in Expo Go.

Usage

import {
  LiquidGlassView,
  LiquidGlassContainerView,
  isLiquidGlassSupported,
} from '@callstack/liquid-glass';

function MyComponent() {
  return (
    <LiquidGlassView
      style={[
        { width: 200, height: 100, borderRadius: 20 },
        !isLiquidGlassSupported && { backgroundColor: 'rgba(255,255,255,0.5)' },
      ]}
      interactive
      effect="clear"
    >
      <Text>Hello World</Text>
    </LiquidGlassView>
  );
}

// For combining multiple glass elements
function MergingGlassElements() {
  return (
    <LiquidGlassContainerView spacing={20}>
      <LiquidGlassView style={{ width: 100, height: 100, borderRadius: 50 }} />
      <LiquidGlassView style={{ width: 100, height: 100, borderRadius: 50 }} />
    </LiquidGlassContainerView>
  );
}

To achieve automatic text color adaptation based on the background behind the glass view, use PlatformColor from react-native:

[!NOTE] There appears to be a size limit for the glass to automatically adapt the text color. If the glass view height is >= 65 it won't automatically adapt to the material behind it.

https://github.com/user-attachments/assets/199bce70-dab4-43bc-9de1-605f561760e5

import { PlatformColor } from 'react-native';
import { LiquidGlassView } from '@callstack/liquid-glass';

function MyComponent() {
  return (
    <LiquidGlassView style={{ padding: 20, borderRadius: 20 }}>
      <Text style={{ color: PlatformColor('labelColor') }}>Hello World</Text>
    </LiquidGlassView>
  );
}

[!NOTE] On unsupported iOS version (below iOS 26), it will render a normal View without any effects.

API

isLiquidGlassSupported

A boolean constant that indicates whether the current device supports the liquid glass effect.

import { isLiquidGlassSupported } from '@callstack/liquid-glass';

if (isLiquidGlassSupported) {
  // Device supports liquid glass effect
} else {
  // Provide fallback UI
}

LiquidGlassView - Props

PropTypeDefaultDescription
interactivebooleanfalseEnables touch interaction effects when pressing the view
effect'clear' | 'regular' | 'none''regular'Visual effect mode:
• clear - More transparent glass effect
• regular - Standard glass blur effect
• none - No glass effect (transparent view)
Note: Changing this property animates the materialization/dematerialization of the glass effect
animatedbooleantrueWhether to animate changes to the glass effect
animationDurationnumberundefinedDuration of the glass effect animation in milliseconds. If omitted, the default UIKit animation duration is used
tintColorColorValueundefinedOverlay color tint applied to the glass effect. Accepts any React Native color format (hex, rgba, named colors)
colorScheme'light' | 'dark' | 'system''system'Color scheme adaptation:
• light - Light appearance
• dark - Dark appearance
• system - Follows system appearance

LiquidGlassContainerView - Props

PropTypeDefaultDescription
spacingnumber0The distance between child elements at which they begin to merge their glass effects into a combined effect

Made with ❤️ at Callstack

liquid-glass is an open source project and will always remain free to use. If you think it's cool, please star it 🌟.

Callstack is a group of React and React Native geeks, contact us at [email protected] if you need any help with these or just want to say hi!

Like the project? ⚛️ Join the team who does amazing stuff for clients and drives React Native Open Source! 🔥

版本与发布记录

@callstack/liquid-glass 共发布 15 个版本,首次发布于 2025/09/02;过去 12 个月发布了 7 个版本。

版本发布日期距今
0.8.2latest2026/09/161 个月前
0.8.12026/08/182 个月前
0.8.02026/06/015 个月前
0.7.12026/03/277 个月前
0.7.02025/12/1710 个月前
0.6.12025/12/0411 个月前

关于 @callstack/liquid-glass 的常见问题

@callstack/liquid-glass 是什么?

Liquid Glass in React Native

如何安装 @callstack/liquid-glass?

在项目目录运行 npm install @callstack/liquid-glass,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(*)、react-native(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@callstack/liquid-glass 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@callstack/liquid-glass 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@callstack/liquid-glass 可以商用吗?

@callstack/liquid-glass 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@callstack/liquid-glass 的下载量有多少?

根据 npm 官方下载统计,@callstack/liquid-glass 在 2026/10/09 – 2026/11/07 这 30 天内被下载 674,704 次,日均约 22,490 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@callstack/liquid-glass 还在维护吗?

最新版本 0.8.2 发布于 2026/09/16(1 个月前);至今共发布 15 个版本,其中过去 12 个月发布了 7 个;首次发布于 2025/09/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。