@@ -1549,7 +1549,7 @@ class ReactImageLightbox extends Component {
1549
1549
}
1550
1550
/>
1551
1551
) }
1552
- </ div > { ' ' }
1552
+ </ div >
1553
1553
</ div >
1554
1554
{ prevSrc && ! isMobile ? (
1555
1555
< button // Move to previous image button
@@ -1600,27 +1600,39 @@ class ReactImageLightbox extends Component {
1600
1600
< div className = "ril__thumbNailsContainer" >
1601
1601
< div className = "ril__thumbNails" >
1602
1602
{ /* TODO previous and Next thumbnail images should show more thumbs if available */ }
1603
- { prevSrc && (
1604
- < button // Move to previous image button
1605
- type = "button"
1606
- className = { `ril__thumbNails ril__navButtonsThumbs${
1607
- this . props . thumbnailArrowLeft ? '' : 'ril__navButtonPrev'
1608
- } `}
1609
- key = "prev"
1610
- aria-label = { this . props . prevLabel }
1611
- title = { this . props . prevLabel }
1612
- onClick = {
1613
- ! this . isAnimating ( ) ? this . requestMovePrev : undefined
1614
- } // Ignore clicks during animation
1615
- style = {
1616
- this . props . thumbnailArrowLeft
1617
- ? {
1618
- background : `url('${ this . props . thumbnailArrowLeft } ') no-repeat center` ,
1619
- }
1620
- : { }
1621
- }
1622
- />
1623
- ) }
1603
+ { prevSrc &&
1604
+ ( this . props . directionalButtonComponent ? (
1605
+ < this . props . directionalButtonComponent
1606
+ onClickHandler = {
1607
+ ! this . isAnimating ( ) ? this . requestMovePrev : undefined
1608
+ }
1609
+ direction = "left"
1610
+ ariaLabel = { this . props . prevLabel }
1611
+ { ...this . props . directionalButtonComponentProps }
1612
+ />
1613
+ ) : (
1614
+ < button // Move to previous image button
1615
+ type = "button"
1616
+ className = { `ril__thumbNails ril__navButtonsThumbs${
1617
+ this . props . thumbnailArrowLeft
1618
+ ? ''
1619
+ : 'ril__navButtonPrev'
1620
+ } `}
1621
+ key = "prev"
1622
+ aria-label = { this . props . prevLabel }
1623
+ title = { this . props . prevLabel }
1624
+ onClick = {
1625
+ ! this . isAnimating ( ) ? this . requestMovePrev : undefined
1626
+ } // Ignore clicks during animation
1627
+ style = {
1628
+ this . props . thumbnailArrowLeft
1629
+ ? {
1630
+ background : `url('${ this . props . thumbnailArrowLeft } ') no-repeat center` ,
1631
+ }
1632
+ : { }
1633
+ }
1634
+ />
1635
+ ) ) }
1624
1636
{ this . props . thumbnailImages . map ( ( img , index ) => (
1625
1637
< img
1626
1638
className = { `thumbNails${
@@ -1642,27 +1654,39 @@ class ReactImageLightbox extends Component {
1642
1654
/>
1643
1655
) ) }
1644
1656
1645
- { nextSrc && (
1646
- < button // Move to next image button
1647
- type = "button"
1648
- className = { `ril__thumbNails ril__navButtonsThumbs${
1649
- this . props . thumbnailArrowRight ? '' : 'ril__navButtonNext'
1650
- } `}
1651
- key = "next"
1652
- aria-label = { this . props . nextLabel }
1653
- title = { this . props . nextLabel }
1654
- onClick = {
1655
- ! this . isAnimating ( ) ? this . requestMoveNext : undefined
1656
- } // Ignore clicks during animation
1657
- style = {
1658
- this . props . thumbnailArrowRight
1659
- ? {
1660
- background : `url('${ this . props . thumbnailArrowRight } ') no-repeat center` ,
1661
- }
1662
- : { }
1663
- }
1664
- />
1665
- ) }
1657
+ { nextSrc &&
1658
+ ( this . props . directionalButtonComponent ? (
1659
+ < this . props . directionalButtonComponent
1660
+ onClickHandler = {
1661
+ ! this . isAnimating ( ) ? this . requestMoveNext : undefined
1662
+ }
1663
+ direction = "right"
1664
+ ariaLabel = { this . props . nextLabel }
1665
+ { ...this . props . directionalButtonComponentProps }
1666
+ />
1667
+ ) : (
1668
+ < button // Move to next image button
1669
+ type = "button"
1670
+ className = { `ril__thumbNails ril__navButtonsThumbs${
1671
+ this . props . thumbnailArrowRight
1672
+ ? ''
1673
+ : 'ril__navButtonNext'
1674
+ } `}
1675
+ key = "next"
1676
+ aria-label = { this . props . nextLabel }
1677
+ title = { this . props . nextLabel }
1678
+ onClick = {
1679
+ ! this . isAnimating ( ) ? this . requestMoveNext : undefined
1680
+ } // Ignore clicks during animation
1681
+ style = {
1682
+ this . props . thumbnailArrowRight
1683
+ ? {
1684
+ background : `url('${ this . props . thumbnailArrowRight } ') no-repeat center` ,
1685
+ }
1686
+ : { }
1687
+ }
1688
+ />
1689
+ ) ) }
1666
1690
</ div >
1667
1691
</ div >
1668
1692
) }
@@ -1825,6 +1849,10 @@ ReactImageLightbox.propTypes = {
1825
1849
closeButtonComponent : PropTypes . element ,
1826
1850
closeButtonComponentProps : PropTypes . shape ( { } ) ,
1827
1851
1852
+ // custom directional button component
1853
+ directionalButtonComponent : PropTypes . element ,
1854
+ directionalButtonComponentProps : PropTypes . shape ( { } ) ,
1855
+
1828
1856
// image header component
1829
1857
imageHeaderComponent : PropTypes . element ,
1830
1858
@@ -1877,6 +1905,8 @@ ReactImageLightbox.defaultProps = {
1877
1905
thumbnailImages : [ ] ,
1878
1906
closeButtonComponent : null ,
1879
1907
closeButtonComponentProps : { } ,
1908
+ directionalButtonComponent : null ,
1909
+ directionalButtonComponentProps : { } ,
1880
1910
imageHeaderComponent : null ,
1881
1911
maxHeightOffset : 0 ,
1882
1912
maxWidthOffset : 0 ,
0 commit comments