diff --git a/src/ui/component/fileActions/view.jsx b/src/ui/component/fileActions/view.jsx index 4ae00a8d1..efcd63f8d 100644 --- a/src/ui/component/fileActions/view.jsx +++ b/src/ui/component/fileActions/view.jsx @@ -4,6 +4,7 @@ import * as ICONS from 'constants/icons'; import * as React from 'react'; import Button from 'component/button'; import Tooltip from 'component/common/tooltip'; +import { requestFullscreen, fullscreenElement } from 'util/full-screen'; type FileInfo = { claim_id: string, @@ -15,15 +16,32 @@ type Props = { openModal: (id: string, { uri: string }) => void, claimIsMine: boolean, fileInfo: FileInfo, + viewerContainer: React.Ref, + showFullscreen: boolean, }; class FileActions extends React.PureComponent { + maximizeViewer = () => { + const { viewerContainer } = this.props; + const isFullscreen = fullscreenElement(); + // Request fullscreen if viewer is ready + // And if there is no fullscreen element active + if (!isFullscreen && viewerContainer && viewerContainer.current !== null) { + requestFullscreen(viewerContainer.current); + } + }; + render() { - const { fileInfo, uri, openModal, claimIsMine, claimId } = this.props; + const { fileInfo, uri, openModal, claimIsMine, claimId, showFullscreen } = this.props; const showDelete = claimIsMine || (fileInfo && Object.keys(fileInfo).length > 0); return ( + {showFullscreen && ( + +