All notable changes to this project will be documented in this file.
- Add
swipe upto close lightbox
- Add inline mode SSR support
- fix next.js + styled-components + SWC client/server classname mismatch error
- Upgrade several dependencies
- @react-spring/web ^9.7
- rollup 3
- typescript 5
This release removes the esm build as it doesn't work well with next.js + SWC compiler
- Allow vertical scrolling with an InlineLightbox on mobile (even while finger is over the image)
- A few small bug fixes in situations where the
itemsarray may change size - Upgrade several dependencies
- "@react-spring/web": "9.5.2"
- "rollup": "^2.77.2",
Lightboxcan now be used as a slider component embedded in a page like slick-slider by using theinlineprop
- Upgrade to
@react-spring/web@9.2.1stable from@tim-soft/react-spring-web@9.0.0-beta.36
- Rewrite project with typescript 4
- Upgrade
react-use-gesture@7.0.15toreact-use-gesture@9.0.4- This upgrade should fix some miscellaneous bugs such as
unable to spread non iterable instanceand more consistent trackpad support
- This upgrade should fix some miscellaneous bugs such as
- The
imagesprop now accepts a list of objects whose properties can be almost any valid React<img />prop includingsrcsetandloading(lazy loading)
If you use typescript, the exact type can be imported/used like this
import Lightbox, { ImagesListType } from 'react-spring-lightbox';
const images: ImagesListType = [
{
alt: 'Windows 10 Dark Mode Setting',
'aria-details': 'Some details',
'aria-disabled': 'false',
loading: 'lazy',
src: 'https://timellenberger.com/static/blog-content/dark-mode/win10-dark-mode.jpg',
srcSet: '/wp-content/uploads/flamingo4x.jpg 4x, /wp-content/uploads/flamingo3x.jpg 3x, /wp-content/uploads/flamingo2x.jpg 2x, /wp-content/uploads/flamingo1x.jpg 1x',
},
{
alt: 'macOS Mojave Dark Mode Setting',
'aria-details': 'Some details',
'aria-disabled': 'false',
loading: 'lazy',
src: 'https://timellenberger.com/static/blog-content/dark-mode/macos-dark-mode.png',
srcSet: '/wp-content/uploads/flamingo4x.jpg 4x, /wp-content/uploads/flamingo3x.jpg 3x, /wp-content/uploads/flamingo2x.jpg 2x, /wp-content/uploads/flamingo1x.jpg 1x',
},
];
const SimpleLightbox = () => <Lightbox images={images} {...otherProps} />;The exact type is:
export type ImagesListItem = Omit<
React.HTMLProps<HTMLImageElement>,
'draggable' | 'onClick' | 'onDragStart' | 'ref'
> & { alt: string; loading?: 'auto' | 'eager' | 'lazy'; src: string };Which translates to any React <img /> prop minus draggable, onClick, onDragStart and ref as they are used internally. alt and src are required and explicitly support loading as it is an experimental chrome feature not included in React.HTMLProps<HTMLImageElement>.
- Use aliased version of react-spring dependencies, fixes "Cannot read property 'ref' of null" error
- Optimize output bundles with Terser
- Apply
babel-plugin-styled-componentsbabel plugin to optimize styled-components styles
- Fix partially off-screen image stage in ie11
- Upgrade to
rollup@2.7.6,react-use-gesture@7.0.15and@babel/****@7.9.6
- Dropped
lodash.clampdependency - Call onPrev/onNext callbacks on all paging events, even at the beginning or end of image array to allow for infinite paging
- Lower distance and velocity gesture threshold for a paging between images
- Allow click to zoom while a paging animation completes
- Upgrade to
rollup@2.3.3andreact-use-gesture@7.0.10 - Add
sideEffects: falsetopackage.json
- Handle edge case bugs with
singleClickToZoomoption - Fix undefined errors in panning drag handler on initial drags
- Add optional
singleClickToZoomprop which allows single click/tap zooming on images
- Add orientationchange event listener for ios devices
- Drop lodash.merge
- Fix image heights not adjusting on window resize
- Remove need for react-use-measure and @juggle/resize-observer
- Fix image stage height on Safari
- Upgrade to react-use-gesture@7.0.5
- Upgrade to rollup@2.0.6
- Replaced inline styles with styled-components. This library now has a peer dependency on
styled-components@5
- Gigantic initial image size in Firefox and MS Edge
- Click background to close functionality
- Vendor prefixed styles
- A resize observer polyfill is now included to support MS Edge
- Added
renderImageOverlayprop, renders a React component within the image stage, useful for creating UI overlays on top of the current image
- Upgrade react-use-gesture v6 -> v7
- Upgrade all deps
- Improved panning performance
- Tweaked mousewheel swiping threshold
- Upgrade to react-use-gesture v6
- Implement mousewheel paging of images
- Prevent vertical dragging from paging images
- Switch to @react-spring/web package
- Properly dispose wheel event listener
- Adjusted "pan out of bounds" threshold
- Implement proper Ctrl +
MousewheelandTrackpad Pinchzooming
Add testing suite and travis-ci config
Upgrade deps and release as stable
- Renamed onClickNext => onNext
- Renamed onClickPrev => onPrev
Initial Release