@blacklab/react-image-magnify

中文文档
4.1.1发布于 2022/05/20MITTypeScriptCommonJS零依赖近 30 天下载 6321

A responsive react image zoom component

原始使用文档
文档目录9 节
  1. React Image Magnify
  2. Installation
  3. Documentation
  4. Example usage
  5. Changes
  6. Support
  7. Contributing
  8. Contributors
  9. License

Magnifying glass

React Image Magnify


A responsive React image zoom component for touch and mouse.

CircleCI



Installation

npm install @blacklab/react-image-magnify

Documentation

View the docs here

Storybook

V1

React Image Magnify is a React Component library that provides

  • In-place and side-by-side image enlargement
  • Positive or negative space guide lens options
  • Interaction hint
  • Configurable enlarged image dimensions
  • Optional enlarged image external render
  • Hover and click intent
  • Long-press gesture
  • Fade transitions

Example usage

import ReactImageMagnify from 'react-image-magnify';

<ReactImageMagnify
    imageProps={{
        alt: 'Wristwatch by Ted Baker London',
        isFluidWidth: true,
        src: watchImg300
    }}
    magnifiedImageProps={{
        src: watchImg1200,
        width: 1200,
        height: 1800
    }}
/>

Changes

Detailed release notes for a given version can be found on our releases page.

Support

Please open an issue.

Contributing

Please contribute using Github Flow. Create a branch, add commits, and open a pull request.

Getting Started

git clone https://github.com/gooftroop/react-image-magnify.git
cd react-image-magnify
npm install
npm run storybook

Contributors

Thanks to the following community members for opening Issues and Pull Requests.

You are awesome! ✨💫

License

MIT

Icons made by Freepik from www.flaticon.com

版本与发布记录

@blacklab/react-image-magnify 共发布 25 个版本,首次发布于 2021/09/16;过去 12 个月发布了 0 个版本。

版本发布日期距今
4.1.1latest2022/05/204 年前
4.1.02022/04/044 年前
4.1.0-alpha.1alpha2022/04/044 年前
4.0.02022/04/044 年前
3.4.12021/09/225 年前
3.4.02021/09/215 年前

关于 @blacklab/react-image-magnify 的常见问题

@blacklab/react-image-magnify 是什么?

A responsive react image zoom component

如何安装 @blacklab/react-image-magnify?

在项目目录运行 npm install @blacklab/react-image-magnify,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@popperjs/core(^2.11.4)、@react-hook/resize-observer(^1.2.5)、detect-it(4.0.1)、react(^16.8 || ^17.0.0 || ^18.0)、react-dom(^16.8 || ^17.0.0 || ^18.0)、react-popper(^2.2.5)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@blacklab/react-image-magnify 支持 TypeScript 吗?

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

@blacklab/react-image-magnify 支持 ESM 还是 CommonJS?

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

@blacklab/react-image-magnify 可以商用吗?

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

@blacklab/react-image-magnify 的下载量有多少?

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

@blacklab/react-image-magnify 还在维护吗?

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