Skip to content

Commit d82d5db

Browse files
committed
Pass in widthBreakPoint
1 parent 5c8d502 commit d82d5db

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

examples/cats/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import ChevronRight from './ChevronRight.svg';
2222

2323
const images = [image1, image2, image3, image4];
2424
const thumbs = [image1Thumb, image2Thumb, image3Thumb, image4Thumb];
25+
const widthBreakPoint = 960;
2526

2627
const CloseSvg = ({
2728
width = 20,
@@ -176,6 +177,7 @@ class App extends Component {
176177
maxWidthOffset={150}
177178
thumbnailArrowLeft={ChevronLeft}
178179
thumbnailArrowRight={ChevronRight}
180+
widthBreakPoint={widthBreakPoint}
179181
/>
180182
);
181183
}

src/react-image-lightbox.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,8 +1446,8 @@ class ReactImageLightbox extends Component {
14461446
...reactModalStyle.content, // Allow style overrides via props
14471447
},
14481448
};
1449-
const widthBreakpoint = 960;
1450-
const isMobile = getWindowWidth() < widthBreakpoint;
1449+
1450+
const isMobile = getWindowWidth() < this.props.widthBreakPoint;
14511451

14521452
return (
14531453
<Modal
@@ -1817,6 +1817,7 @@ ReactImageLightbox.propTypes = {
18171817
maxWidthOffset: PropTypes.number,
18181818
thumbnailArrowLeft: PropTypes.element,
18191819
thumbnailArrowRight: PropTypes.element,
1820+
widthBreakPoint: PropTypes.string,
18201821
};
18211822

18221823
ReactImageLightbox.defaultProps = {
@@ -1864,6 +1865,7 @@ ReactImageLightbox.defaultProps = {
18641865
maxWidthOffset: 0,
18651866
thumbnailArrowLeft: null,
18661867
thumbnailArrowRight: null,
1868+
widthBreakPoint: null,
18671869
};
18681870

18691871
export default ReactImageLightbox;

0 commit comments

Comments
 (0)