Skip to content
Snippets Groups Projects
Commit 75a94c2f authored by chrisgarrity's avatar chrisgarrity
Browse files

Try to run in full screen on tablets

Using `bowser` to detect tablets, and type of browser to call either `webkitRequestFullScreen()` or `mozRequestFullScreen()`

Full screen request must happen in reponse to a user-action, so it’s included in the ‘try-it’ handler for the preview modal.
parent f0cadc47
Branches
Tags
No related merge requests found
......@@ -3,6 +3,8 @@ import PropTypes from 'prop-types';
import React from 'react';
import {connect} from 'react-redux';
import tabletFullScreen from '../lib/tablet-full-screen';
import PreviewModalComponent from '../components/preview-modal/preview-modal.jsx';
import BrowserModalComponent from '../components/browser-modal/browser-modal.jsx';
import supportedBrowser from '../lib/supported-browser';
......@@ -27,6 +29,8 @@ class PreviewModal extends React.Component {
}
handleTryIt () {
this.setState({previewing: true});
// try to run in fullscreen mode on tablets.
tabletFullScreen();
this.props.onTryIt();
}
handleCancel () {
......
import bowser from 'bowser';
/**
* Helper method to request full screen in the browser when on a tablet.
*/
export default function () {
if (bowser.tablet) {
if (bowser.webkit || bowser.blink) {
document.documentElement.webkitRequestFullScreen();
}
if (bowser.gecko) {
document.documentElement.mozRequestFullScreen();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment