@applicaster/blur

中文文档
4.4.1发布于 2024/11/14MITTypeScriptESM + CJS零依赖近 30 天下载 1812

React Native Blur component

原始使用文档
文档目录7 节
  1. Current Maintainers:
  2. Content
  3. Installation
  4. Usage
  5. VibrancyView
  6. Example React Native App
  7. Questions?

@react-native-community/blur

npm version

A component for UIVisualEffectView's blur and vibrancy effect on iOS, and BlurView on Android.

Current Maintainers:

Content

Installation

yarn add @react-native-community/blur

Install native dependencies (iOS only):

cd ios && pod install

Usage

BlurView

PropertyPossible ValuesDefaultPlatform
blurTypeSee blurType below-All
blurAmount0 - 100 (The maximum blurAmount on Android is 32, so higher values will be clamped to 32)10All
reducedTransparencyFallbackColorAny color-iOS only
blurRadius0 - 25Matches iOS blurAmountAndroid only
downsampleFactor0 - 25Matches iOS blurAmountAndroid only
overlayColorAny colorDefault color based on iOS blurTypeAndroid only

blurType

NameDescription
xlightextra light blur type
lightlight blur type
darkdark blur type
extraDarkextra dark blur type (tvOS only)
regularregular blur type (iOS 10+ and tvOS only)
prominentprominent blur type (iOS 10+ and tvOS only)

blurType (iOS 13 only)

NameDescription
chromeMaterialAn adaptable blur effect that creates the appearance of the system chrome.
materialAn adaptable blur effect that creates the appearance of a material with normal thickness.
thickMaterialAn adaptable blur effect that creates the appearance of a material that is thicker than normal.
chromeMaterialAn adaptable blur effect that creates the appearance of the system chrome.
thinMaterialAn adaptable blur effect that creates the appearance of an ultra-thin material.
ultraThinMaterialAn adaptable blur effect that creates the appearance of an ultra-thin material.
chromeMaterialDarkA blur effect that creates the appearance of an ultra-thin material and is always dark.
materialDarkA blur effect that creates the appearance of a thin material and is always dark.
thickMaterialDarkA blur effect that creates the appearance of a material with normal thickness and is always dark.
thinMaterialDarkA blur effect that creates the appearance of a material that is thicker than normal and is always dark.
ultraThinMaterialDarkA blur effect that creates the appearance of the system chrome and is always dark.
chromeMaterialLightAn adaptable blur effect that creates the appearance of the system chrome.
materialLightAn adaptable blur effect that creates the appearance of a material with normal thickness.
thickMaterialLightAn adaptable blur effect that creates the appearance of a material that is thicker than normal.
thinMaterialLightAn adaptable blur effect that creates the appearance of a thin material.
ultraThinMaterialLightAn adaptable blur effect that creates the appearance of an ultra-thin material.

Complete usage example that works on iOS and Android:

import React, { Component } from "react";
import { View, Image, Text, StyleSheet } from "react-native";
import { BlurView } from "@react-native-community/blur";

export default function Menu() {
  return (
    <View style={styles.container}>
      <Image
        key={'blurryImage'}
        source={{ uri }}
        style={styles.absolute}
      />
      <Text style={styles.absolute}>Hi, I am some blurred text</Text>
      {/* in terms of positioning and zIndex-ing everything before the BlurView will be blurred */}
      <BlurView
        style={styles.absolute}
        blurType="light"
        blurAmount={10}
        reducedTransparencyFallbackColor="white"
      />
      <Text>I'm the non blurred text because I got rendered on top of the BlurView</Text>
    </View>
  )
}

const styles = StyleSheet.create({
  container: {
    justifyContent: "center",
    alignItems: "center"
  },
  absolute: {
    position: "absolute",
    top: 0,
    left: 0,
    bottom: 0,
    right: 0
  }
});

In this example, the Image component will be blurred, because the BlurView in positioned on top. But the Text will stay unblurred.

If the accessibility setting Reduce Transparency is enabled the BlurView will use reducedTransparencyFallbackColor as it's background color rather than blurring. If no reducedTransparencyFallbackColor is provided, theBlurViewwill use the default fallback color (white, black, or grey depending on blurType)

VibrancyView

Uses the same properties as BlurView (blurType, blurAmount, and reducedTransparencyFallbackColor).

The vibrancy effect lets the content underneath a blurred view show through more vibrantly

VibrancyView is only supported on iOS. Also note that the VibrancyView must contain nested views

import { VibrancyView } from "@react-native-community/blur";

export default function Menu() {
  return (
    <Image source={{ uri }} style={styles.absolute}>
      <VibrancyView blurType="light" style={styles.flex}>
      <Text>Hi, I am some vibrant text.</Text>
      </VibrancyView>
    </Image>
  )
}

Example React Native App

This project includes an example React Native app, which was used to make the GIF in this README. You can run the apps by following these steps:

Clone the repository

git clone https://github.com/react-native-community/react-native-blur.git

Install dependencies

yarn

Run the app

yarn example android/ios

Questions?

Feel free to create an issue

版本与发布记录

@applicaster/blur 共发布 1 个版本,首次发布于 2024/11/14;过去 12 个月发布了 0 个版本。

版本发布日期距今
4.4.1latest2024/11/142 年前

关于 @applicaster/blur 的常见问题

@applicaster/blur 是什么?

React Native Blur component

如何安装 @applicaster/blur?

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

@applicaster/blur 支持 TypeScript 吗?

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

@applicaster/blur 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@applicaster/blur 可以商用吗?

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

@applicaster/blur 的下载量有多少?

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

@applicaster/blur 还在维护吗?

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