Release 2.0 comes with some minor breaking changes. Although the list is relatively long, the migration should be trivial for most users. Be sure to review the items that apply in your case.
v2 does not provide a default value for the defaultContainerWidth prop. If not defined, PhotoAlbum produces empty markup on the server and renders actual markup only on the client after hydration. If you prefer the markup to be generated on the server, you must explicitly set the defaultContainerWidth prop.
columnConstraints prop is no longer supported
v2 strictly adheres to the columns value when rendering columns or masonry layout. It renders empty columns when there aren't enough images to fill all columns, so the columnConstraints.minColumns prop is no longer relevant. However, if you prefer how things worked in v1, you can implement v1 behavior through the columns prop:
resizeObserverProvider prop is no longer supported
v2 no longer supports custom resize observers, and only global ResizeObserver is used.
renderContainer prop no longer accepts React.forwardRef
v2 no longer accepts forwardRef-wrapped component in the renderContainer prop. You must pass the containerRef to the <div/> element when rendering custom container.
v2 no longer provides the layoutOptions parameter as part of the renderContainer render function parameters. layoutOptions parameter was replaced with layout.
viewportWidth is no longer provided in the layoutOptions
v2 no longer provides the viewportWidth value in the layoutOptions object.
containerWidth parameter in the componentsProps is now optional
v2 Breaking Changes
Release 2.0 comes with some minor breaking changes. Although the list is relatively long, the migration should be trivial for most users. Be sure to review the items that apply in your case.
onClick callback signature change
v1:
v2:
SSR and defaultContainerWidth
v2 does not provide a default value for the
defaultContainerWidth
prop. If not defined,PhotoAlbum
produces empty markup on the server and renders actual markup only on the client after hydration. If you prefer the markup to be generated on the server, you must explicitly set thedefaultContainerWidth
prop.columnConstraints prop is no longer supported
v2 strictly adheres to the
columns
value when renderingcolumns
ormasonry
layout. It renders empty columns when there aren't enough images to fill all columns, so thecolumnConstraints.minColumns
prop is no longer relevant. However, if you prefer how things worked in v1, you can implement v1 behavior through thecolumns
prop:resizeObserverProvider prop is no longer supported
v2 no longer supports custom resize observers, and only global
ResizeObserver
is used.renderContainer prop no longer accepts React.forwardRef
v2 no longer accepts
forwardRef
-wrapped component in therenderContainer
prop. You must pass thecontainerRef
to the<div/>
element when rendering custom container.renderContainer signature change
v2 no longer provides the
layoutOptions
parameter as part of therenderContainer
render function parameters.layoutOptions
parameter was replaced withlayout
.viewportWidth is no longer provided in the layoutOptions
v2 no longer provides the
viewportWidth
value in thelayoutOptions
object.containerWidth parameter in the componentsProps is now optional
package bundle changes
React.createElement
index.esm.js
toindex.mjs
index.cjs.js
toindex.js
type definitions changes
RowContainerProps
type was renamed toRenderRowContainerProps
ColumnContainerProps
type was renamed toRenderColumnContainerProps
PhotoProps
type was renamed toRenderPhotoProps
ContainerProps
type type was removedRenderContainer
andRenderContainerProps
types are no longer generic