Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ preloadNextImage | bool | true | Based on the direction the user is navigating,
rightArrowTitle | string | ' Next (Right arrow key) ' | Customize right arrow title
showCloseButton | bool | true | Optionally display a close "X" button in top right corner
showImageCount | bool | true | Optionally display image index, e.g., "3 of 20"
width | number | 1024 | Maximum width of the carousel; defaults to 1024px
width | number\|string | 1024 | Maximum width of the carousel; defaults to 1024px. Accepts values as `px`, `vw`, `%`, `none`, `initial` or `inherit`. A plain number defaults to usage in `px`.
spinner | func | DefaultSpinner | Spinner component class
spinnerColor | string | 'white' | Color of spinner
spinnerSize | number | 100 | Size of spinner
Expand Down
4 changes: 2 additions & 2 deletions examples/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ <h2>Options</h2>
</tr>
<tr>
<td align="left">width</td>
<td align="left">number</td>
<td align="left">number|string</td>
<td align="left">1024</td>
<td align="left">Maximum width of the carousel; defaults to 1024px</td>
<td align="left">Maximum width of the carousel; defaults to 1024px. Accepts values as <code>px</code>, <code>vw</code>, <code>%</code>, <code>none</code>, <code>initial</code> or <code>inherit</code>. A plain number defaults to usage in <code>px</code>.</td>
</tr>
</tbody>
</table>
Expand Down
9 changes: 8 additions & 1 deletion src/Lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,14 @@ Lightbox.propTypes = {
spinnerSize: PropTypes.number,
theme: PropTypes.object,
thumbnailOffset: PropTypes.number,
width: PropTypes.number,
width: function (props, propName, componentName) {
if (!/^\d+(px|%|vw|$)|initial|inherit|none/.test(props[propName])) {
return new Error(
'Invalid prop `' + propName + '` supplied to `' + componentName + '`. '
+ 'Valid values are `initial`, `inherit`, `none` or a number as `px`, `vw` or `%`.'
);
}
},
};
Lightbox.defaultProps = {
closeButtonTitle: 'Close (Esc)',
Expand Down