A React photo preview component for image galleries with pinch-to-zoom, swipe, and keyboard navigation. Current stable version is 1.2.7. Released regularly with bug fixes and minor enhancements. Differentiators include full-screen overlay, customizable toolbar, and support for lazy loading. TypeScript definitions are included. Requires react >= 16.8.0 and react-dom >= 16.8.0.
npm install react-photo-viewNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic setup with PhotoProvider wrapper and PhotoView component using a sample image URL.
Add import 'react-photo-view/dist/react-photo-view.css';
If you were using it without children, it still works, but update code if you relied on children for triggering.
Ensure the PhotoProvider or a descendant element is focusable.
Avoid nesting PhotoProvider components; use a single provider per page.
Add import 'react-photo-view/dist/react-photo-view.css'; in your entry file.
Ensure each PhotoView has a valid src prop.
Use src prop instead of photoViewSrc.