![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
rc-image
Advanced tools
Package description
The rc-image npm package is a React component library for displaying images in a more versatile and enhanced manner. It provides features such as modal viewing, image rotation, zooming, and dragging, making it a powerful tool for implementing image galleries or for enhancing the image viewing experience in web applications.
Modal Image Viewing
This feature allows images to be viewed in a modal (popup) when clicked, providing a closer look. The code sample demonstrates how to enable modal viewing with visibility control.
{"import React from 'react';\nimport Image from 'rc-image';\n\nexport default () => (\n <Image\n preview={{\n visible: true,\n onVisibleChange: (vis) => console.log('visible:', vis),\n }}\n src='path/to/image.jpg'\n />\n);"}
Image Rotation
Enables the rotation of images. This example shows how to rotate an image by 90 degrees using inline styles.
{"import React from 'react';\nimport Image from 'rc-image';\n\nexport default () => (\n <Image\n style={{ transform: 'rotate(90deg)' }}\n src='path/to/image.jpg'\n />\n);"}
Zoom and Drag
This feature allows users to zoom in/out on images and drag them around for better viewing. The code sample demonstrates enabling zoom and drag capabilities in the preview modal.
{"import React from 'react';\nimport Image from 'rc-image';\n\nexport default () => (\n <Image\n preview={{\n zoomable: true,\n draggable: true,\n }}\n src='path/to/image.jpg'\n />\n);"}
A flexible and responsive lightbox component for displaying images and videos in React. It offers similar modal viewing capabilities but is more focused on lightbox functionalities and does not support image rotation or dragging out of the box.
This package is designed for creating image galleries in React applications. It supports thumbnail navigation, fullscreen mode, and custom renderers but lacks the advanced image manipulation features like rotation and dragging found in rc-image.
Offers a rich set of features for image viewing in React, including pinch to zoom, slide to close, and rotation. It is similar to rc-image in terms of providing an enhanced image viewing experience but focuses more on touch interactions.
Readme
React Image.
npm install
npm start
const Image = require('rc-image');
ReactDOM.render(
<Image src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
), document.getElementById('root'));
Name | Type | Default | Description |
---|---|---|---|
preview | boolean | { visible: boolean, scaleStep: number, onVisibleChange: function(value, prevValue), getContainer: string | HTMLElement | (() => HTMLElement) | false } | true | Whether to show preview |
prefixCls | string | rc-image | Classname prefix |
placeholder | boolean | ReactElement | - | if true will set default placeholder or use ReactElement set customize placeholder |
fallback | string | - | Load failed src |
previewPrefixCls | string | rc-image-preview | Preview classname prefix |
onError | (event: Event) => void | - | Load failed callback |
preview the merged src
const Image = require('rc-image');
ReactDOM.render(
<Image.PreviewGroup>
<Image src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
<Image src="https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*P0S-QIRUbsUAAAAAAAAAAABkARQnAQ" />
</Image.PreviewGroup>
), document.getElementById('root'));
Name | Type | Default | Description |
---|---|---|---|
preview | boolean | { visible: boolean, scaleStep: number, onVisibleChange: function(value, prevValue), getContainer: string | HTMLElement | (() => HTMLElement) | false, countRender?: (current: number, total: number) => string, current: number } | true | Whether to show preview, current: If Preview the show img index, default 0 |
previewPrefixCls | string | rc-image-preview | Preview classname prefix |
icons | { [iconKey]?: ReactNode } | - | Icons in the top operation bar, iconKey: 'rotateLeft' | 'rotateRight' | 'zoomIn' | 'zoomOut' | 'close' | 'left' | 'right' |
http://localhost:8003/examples/
npm test
npm run coverage
rc-image is released under the MIT license.
FAQs
React easy to use image component
We found that rc-image demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.