From 29a12c152a119188b8118cba68330ded76baa160 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Thu, 10 Dec 2020 23:06:55 +0100 Subject: [PATCH] MM-31202 | MM-30866 fix: Video playback button & hide header footer on playback (#5014) (#5027) * MM-31202 | MM-30866 fix: Video playback button & hide header footer on playback * Feedback review (cherry picked from commit 9abc89129bff36ff240adea5514de7a68f5f0b12) Co-authored-by: Elias Nahum --- app/screens/gallery/footer/index.tsx | 1 + app/screens/gallery/gallery.js | 11 ++++-- app/screens/gallery/gallery_video.tsx | 48 ++++++++------------------ app/screens/gallery/gallery_viewer.tsx | 10 ++++-- app/screens/gallery/video_controls.tsx | 37 +++++++++++++++----- types/screens/gallery.d.ts | 3 +- 6 files changed, 62 insertions(+), 48 deletions(-) diff --git a/app/screens/gallery/footer/index.tsx b/app/screens/gallery/footer/index.tsx index 4997de166..fe8c42793 100644 --- a/app/screens/gallery/footer/index.tsx +++ b/app/screens/gallery/footer/index.tsx @@ -129,6 +129,7 @@ const Footer = forwardRef((props: FooterProps, ref) => { useImperativeHandle(ref, () => ({ isVisible, + setVisible, toggle, }), [visible]); diff --git a/app/screens/gallery/gallery.js b/app/screens/gallery/gallery.js index 4fe10d535..0828b524f 100644 --- a/app/screens/gallery/gallery.js +++ b/app/screens/gallery/gallery.js @@ -128,8 +128,15 @@ export default class Gallery extends PureComponent { this.setState({index}, this.initHeader); }; - handleTapped = () => { - const visible = this.footer.current?.getWrappedInstance()?.toggle(); + handleTapped = (display) => { + let visible; + if (display === undefined) { + visible = this.footer.current?.getWrappedInstance()?.toggle(); + } else { + visible = display; + this.footer.current?.getWrappedInstance()?.setVisible(display); + } + const options = { topBar: { background: { diff --git a/app/screens/gallery/gallery_video.tsx b/app/screens/gallery/gallery_video.tsx index 9c8b146a2..66fc6ec36 100644 --- a/app/screens/gallery/gallery_video.tsx +++ b/app/screens/gallery/gallery_video.tsx @@ -16,7 +16,7 @@ import {GalleryItemProps} from 'types/screens/gallery'; import VideoControls, {VideoControlsRef} from './video_controls'; -const GalleryVideo = ({file, deviceHeight, deviceWidth, intl, isActive, onDoubleTap, theme}: GalleryItemProps) => { +const GalleryVideo = ({file, deviceHeight, deviceWidth, intl, isActive, showHideHeaderFooter, theme}: GalleryItemProps) => { const statusBar = DeviceTypes.IS_IPHONE_WITH_INSETS ? 0 : 20; const width = deviceWidth; const height = deviceHeight - statusBar; @@ -25,16 +25,6 @@ const GalleryVideo = ({file, deviceHeight, deviceWidth, intl, isActive, onDouble const [paused, setPaused] = useState(true); const videoRef = useRef