Photo Browser React Component

    Photo Browser is an photo browser component to display collection of photos / images. Photos can be zoomed and panned (optional).

    Photo Browser React component doesn’t render any output. It can be used to create JS Photo Browser instance and control it inside of your React component.

    • / **F7PhotoBrowser**

    Photo Browser Properties

    You can pass all parameters in single params property or use separate props for each parameter to specify them via component properties:

    Photo Browser Methods

    You can access Photo Browser initialized instance by accessing **.f7PhotoBrowser** component’s property.

    Examples

    1. export default class extends React.Component {
    2. constructor(props) {
    3. super(props);
    4. this.state = {
    5. photos: [
    6. {
    7. url: 'img/beach.jpg',
    8. caption: 'Amazing beach in Goa, India',
    9. },
    10. 'http://placekitten.com/1024/1024',
    11. 'img/lock.jpg',
    12. {
    13. url: 'img/monkey.jpg',
    14. caption: 'I met this monkey in Chinese mountains',
    15. },
    16. {
    17. url: 'img/mountains.jpg',
    18. caption: 'Beautiful mountains in Zhangjiajie, China',
    19. },
    20. ],
    21. }
    22. }
    23. render() {
    24. <Page>
    25. <Block>
    26. <p>Photo Browser could be opened in a three ways - as a Standalone component (Popup modification), in Popup, and as separate Page:</p>
    27. <Row>
    28. <Col>
    29. <PhotoBrowser
    30. photos={this.state.photos}
    31. ref={(el) => {this.standalone = el}}
    32. />
    33. <Button raised onClick={() => this.standalone.open()}>Standalone</Button>
    34. </Col>
    35. <Col>
    36. <PhotoBrowser
    37. photos={this.state.photos}
    38. type="popup"
    39. ref={(el) => {this.popup = el}}
    40. />
    41. <Button raised onClick={() => this.popup.open()}>Popup</Button>
    42. </Col>
    43. <Col>
    44. <PhotoBrowser
    45. photos={this.state.photos}
    46. type="page"
    47. backLinkText="Back"
    48. ref={(el) => {this.page = el}}
    49. />
    50. <Button raised onClick={() => this.page.open()}>Page</Button>
    51. </Col>
    52. </Row>
    53. </Block>
    54. <Row>
    55. <Col>
    56. <PhotoBrowser
    57. photos={this.state.photos}
    58. theme="dark"
    59. ref={(el) => {this.standaloneDark = el}}
    60. />
    61. <Button raised onClick={() => this.standaloneDark.open()}>Standalone</Button>
    62. </Col>
    63. <Col>
    64. <PhotoBrowser
    65. photos={this.state.photos}
    66. theme="dark"
    67. type="popup"
    68. ref={(el) => {this.popupDark = el}}
    69. />
    70. <Button raised onClick={() => this.popupDark.open()}>Popup</Button>
    71. </Col>
    72. <Col>
    73. <PhotoBrowser
    74. photos={this.state.photos}
    75. theme="dark"
    76. type="page"
    77. backLinkText="Back"
    78. ref={(el) => {this.pageDark = el}}
    79. />
    80. <Button raised onClick={() => this.pageDark.open()}>Page</Button>
    81. </Col>
    82. </Row>
    83. </Block>
    84. </Page>
    85. );
    86. };