# @d11/react-native-fast-image 中文文档

规范地址：https://npmcn.com/package/%40d11/react-native-fast-image/

版本：8\.13\.0
npm 元数据更新时间：2026-07-09T09:51:41.060Z
中文译文更新时间：2026-11-11T07:51:16.157Z
软件包许可：\(MIT AND Apache-2\.0\)

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40d11/react-native-fast-image
原文对照：https://npmcn.com/package/%40d11/react-native-fast-image/?lang=original
项目主页：https://github.com/ds-horizon/react-native-fast-image#readme
源码仓库：https://github.com/ds-horizon/react-native-fast-image

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：154 kB，62 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- peer 依赖：react \*，react-native \*
- 首次发布：2024-05-23T07:26:23.066Z
- 最新版本发布：2025-11-05T13:38:32.702Z
- 近 30 天下载量：664215（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：148（近 12 个月 0 个）

## 中文简介

QQ FastImage, 表演者反应原生图像组件.

## 安装

```sh
npm install @d11/react-native-fast-image
```

也可以使用：`pnpm add @d11/react-native-fast-image`、`yarn add @d11/react-native-fast-image`、`bun add @d11/react-native-fast-image`

## README

###### 这是叉子 [反应-内生-快成像](https://github.com/DylanVann/react-native-fast-image)。所有功劳都归原作者所有.

# 快速图像

React Natural 的高性能图像组件,现已为 **新建反应原生建筑**!

## 为何如此?

**快速图像** 现在包括:

-   **涡轮摩多** 财务报告和审定财务报表 **家具渲染器** 用于增强性能的相容性.
-   **AVIF 图像支持** 用于下源图像格式.
-   相对于原始寄存器, 有许多错误修正和性能改进 .

## 为什么选择快照?

FastImage 是 React Industrial 的倒置替代品 `Image` 组件,为常见图像加载挑战提供解决方案,例如:

-   装入时闪烁
-   缓存不一致
-   从缓存中缓慢加载
-   总体业绩欠佳

快速图像杠杆 **[SDWebImage (iOS) (英语)](https://github.com/rs/SDWebImage)** 财务报告和审定财务报表 **[胶体 (Android)](https://github.com/bumptech/glide)** 用于本地的缓冲和高效.

  

[![Version](https://img.shields.io/npm/v/@d11/react-native-fast-image.svg)](https://www.npmjs.com/package/@d11/react-native-fast-image) [![Downloads](https://img.shields.io/npm/dm/@d11/react-native-fast-image.svg)](http://www.npmtrends.com/@d11/react-native-fast-image) [![Build Status](https://github.com/ds-horizon/react-native-fast-image/workflows/CI/badge.svg)](https://github.com/ds-horizon/react-native-fast-image/actions?query=workflow%3ACI) [![Code Coverage](https://img.shields.io/codecov/c/github/ds-horizon/react-native-fast-image.svg)](https://codecov.io/github/ds-horizon/react-native-fast-image)

[![Watch on GitHub](https://img.shields.io/github/watchers/ds-horizon/react-native-fast-image.svg?style=social)](https://github.com/ds-horizon/react-native-fast-image/watchers) [![Star on GitHub](https://img.shields.io/github/stars/ds-horizon/react-native-fast-image.svg?style=social)](https://github.com/ds-horizon/react-native-fast-image/stargazers) [![Tweet](https://img.shields.io/twitter/url/https/github.com/ds-horizon/react-native-fast-image.svg?style=social)](https://twitter.com/home?status=Check%20out%20react-native-fast-image%20by%20%40atomarranger%20https%3A//github.com/ds-horizon/react-native-fast-image)

 ![](https://github.com/ds-horizon/react-native-fast-image/blob/main/docs/assets/scroll.gif?raw=true "Scroll Demo")![](https://github.com/ds-horizon/react-native-fast-image/blob/main/docs/assets/priority.gif?raw=true "Priority Demo")  
经验点燃-快速图像 与最新的反应原生技术.

## \* 特性

-   {\\fn黑体\\fs22\\bord1\\shad0\\3aHBE\\4aH00\\fscx67\\fscy66\\2cHFFFFFF\\3cH808080}冲锋而入 {\\fn黑体\\fs22\\bord1\\shad0\\3aHBE\\4aH00\\fscx67\\fscy66\\2cHFFFFFF\\3cH808080}快.
-   ✅自定义的授权头.
-   QQ 优先图像加载 .
-   QQ 预装即时显示 .
-   ++ 完整GIF、SVG和 **AVIF支助**。 。 。 .
-   \* 支持 `borderRadius`。 。 。 .
-   QQ支持Fabric Render (v8.7.0+).
-   QQ支持涡轮摩多列车(v8.8.0+).

## \* 安装

要在您的工程中安装 FastImage, 请运行 :

使用 `yarn`数字 :

```bash
yarn add @d11/react-native-fast-image
cd ios && pod install
```

或者说用 `npm`数字 :

```bash
npm install @d11/react-native-fast-image
cd ios && pod install
```

> **说明**: 您必须使用 React Industrial 0. 60.0 或更高版本来使用最新版本 `@d11/react-native-fast-image`。 。 。 .

### 可选: 禁用 SVG 解码器

如果您不需要 SVG 支持, 您可以通过环境变量来禁用 SVG 解码器, 以减少本地依赖/ 二进制大小 :

-   iOS( 在运行可可花前):

```bash
export DISABLE_SVG=1 
cd ios && pod install
```

-   Android(建筑前):

```bash
export DISABLE_SVG=1
# then build as usual, e.g.
yarn android
```

要重新启用 SVG 支持, 请取消变量或设置为 0 , 并重新安装 cocks/ 重建 .

### 用法示例

```jsx
import FastImage from "@d11/react-native-fast-image";
import * as React from "react";

const YourImage = () => (
  <FastImage
    style={{ width: 200, height: 200 }}
    source={{
      uri: "https://unsplash.it/400/400?image=1",
      headers: { Authorization: "someAuthToken" },
      priority: FastImage.priority.normal,
    }}
    resizeMode={FastImage.resizeMode.contain}
  />
);
```

## 已使用胶片 `AppGlideModule`? 吗?

如果你已经使用Glide和一个 `AppGlideModule`, (中文(简体) ), [读取此指南](https://npmcn.com/package/%40d11/react-native-fast-image/docs/app-glide-module.md) 确保顺利整合.

## ProGuard 配置

如果使用 [保护](https://www.guardsquare.com/proguard),将这些规则添加到 `android/app/proguard-rules.pro`数字 :

```pro
-keep public class com.dylanvann.fastimage.* {*;}
-keep public class com.dylanvann.fastimage.** {*;}
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}
```

## API 文档

### 属性

| 财产 | 类型 | 说明 |
| --- | --- | --- |
| `source` | `object` | 远程图像的来源 。 接受具有子属性的对象 `uri`, (中文(简体) ), `headers`, (中文(简体) ), `priority`,以及 `cache`。 。 。 . |
| `source.uri` | `string` | 装入图像的 URL 。 例如, `"https://unsplash.it/400/400?image=1"`。 。 。 . |
| `source.headers` | `object` | 装入图像的页眉,例如, `{ Authorization: "someAuthToken" }`。 。 。 . |
| `source.priority` | `FastImage.priority` | 装入优先级 :  
\- 说吧 `FastImage.priority.low`  
\- 说吧 `FastImage.priority.normal` **(违约)**  
\- 说吧 `FastImage.priority.high` |
| `source.cache` | `FastImage.cacheControl` | 缓存控制 :  
\- 说吧 `FastImage.cacheControl.immutable` **(违约)**  
\- 说吧 `FastImage.cacheControl.web`  
\- 说吧 `FastImage.cacheControl.cacheOnly` |
| `defaultSource` | `number` | 装入的资产 `require()` 或者说 `import`. 注:关于Android, `defaultSource` 不在调试模式下工作. |
| `resizeMode` | `FastImage.resizeMode` | 调整模式 :  
\- 说吧 `FastImage.resizeMode.contain`  
\- 说吧 `FastImage.resizeMode.cover` **(违约)**  
\- 说吧 `FastImage.resizeMode.stretch`  
\- 说吧 `FastImage.resizeMode.center` |
| `transition` | `FastImage.transition` | 显示图像时应用的过渡 :  
\- 说吧 `FastImage.transition.none` **(违约)**  
\- 说吧 `FastImage.transition.fade` (反应原生图像等同) |
| `onLoadStart` | `function` | 当图像开始装入时调用 . |
| `onProgress` | `(event: OnProgressEvent) => void` | 图像装入时召回 `event.nativeEvent.loaded` 财务报告和审定财务报表 `event.nativeEvent.total` 字节. |
| `onLoad` | `(event: OnLoadEvent) => void` | 当图像成功装入时调用 `event.nativeEvent.width` 财务报告和审定财务报表 `event.nativeEvent.height` 数值. |
| `onError` | `(event: OnErrorEvent) => void` | 当装入图像时出错或源头畸形时调用 `event.nativeEvent.error`。 。 。 . |
| `onLoadEnd` | `function` | 图像装入完成后调用, 无论成功还是失败 . |
| `style` | `ViewStyle` | 图像组件的样式, 支持 `borderRadius`。 。 。 . |
| `fallback` | `boolean` | 若为 `true`,它会回到使用 `Image`样式和布局 `FastImage`。 。 。 . |
| `tintColor` | `number` 或者说 `string` | 图像中所有不透明像素的颜色符号 . |
| `testID` | `string` | 测试的可选身份证,例如: [`react-test-renderer`](https://www.npmjs.com/package/react-test-renderer)。 。 。 . |
| `blurRadius` | `number` | 用于调整图像中模糊度的参数. |

### 静态方法

| 方法 | 说明 |
| --- | --- |
| `FastImage.preload(sources: object[])` | 预装图像, 以在渲染时更快显示 .  
示例 `FastImage.preload([{ uri: "https://unsplash.it/400/400?image=1" }])`。 。 。 . |
| `FastImage.clearMemoryCache(): Promise<void>` | 清除内存缓存中的所有图像. |
| `FastImage.clearDiskCache(): Promise<void>` | 清除磁盘缓存中的所有图像. |

## 捐款

我们欢迎为改善快照作出贡献! 请检查我们的 [贡献指南](https://npmcn.com/package/%40d11/react-native-fast-image/CONTRIBUTING.md) 关于如何开展工作的准则.

## \* 解决问题

如果您在使用此库时遇到问题,请尝试我们 [解决问题指南](https://npmcn.com/package/%40d11/react-native-fast-image/docs/troubleshooting.md)。 。 。 .

## QQ 支持的回放原生版本

该项目旨在支持最新版本的 " React Introduction " ,简化开发和测试。 对于更古老的版本,如果需要特定特性或错误修正,请考虑取消寄存器.

## • 信贷

这个模块的最初想法来自 [@vovkasm (英语)](https://github.com/vovkasm)’: [反应-内生-网络图像](https://github.com/vovkasm/react-native-web-image) 软件包.

特别感谢:

-   **@mobinni (英语)** 帮助构思.
-   [SDWeb 图像](https://github.com/rs/SDWebImage) (iOS)和 [胶片](https://github.com/bumptech/glide) (Android)用于强大的图像缓冲.

## 许可证

-   **快速图像** -麻省理工学院 [梦想体育实验室](https://github.com/ds-horizon)
-   **SDWeb 图像** -麻省理工学院
-   **胶片** – BSD, Part MIT, Apache 2.0. 见 [自由主义](https://github.com/bumptech/glide/blob/master/LICENSE) 详细情况.

## 常见问题

### @d11/react-native-fast-image 是什么？

QQ FastImage, 表演者反应原生图像组件\.

### 如何安装 @d11/react-native-fast-image？

在项目目录运行 npm install @d11/react-native-fast-image，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：react（\*）、react-native（\*）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @d11/react-native-fast-image 支持 TypeScript 吗？

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

### @d11/react-native-fast-image 支持 ESM 还是 CommonJS？

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

### @d11/react-native-fast-image 可以商用吗？

@d11/react-native-fast-image 使用 \(MIT AND Apache-2\.0\) 许可。声明的许可为 \(MIT AND Apache-2\.0\)，请阅读许可原文确认使用条件。以上为概括，不构成法律意见，请以许可原文为准。

### @d11/react-native-fast-image 的下载量有多少？

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

### @d11/react-native-fast-image 还在维护吗？

最新版本 8\.13\.0 发布于 2025/11/05（1 年前）；至今共发布 148 个版本，其中过去 12 个月发布了 0 个；首次发布于 2024/05/23。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

