Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from "react";
- const splitScreenPages = ['PAGE_CONFIRM', 'PAGE_QUIZ'];
- class App extends Component {
- componentDidUpdate(prevProps) {
- if (prevProps.page !== this.props.page) {
- if (splitScreenPages.includes(this.props.page)) this.setSplitScreen();
- if (!splitScreenPages.includes(this.props.page)) this.setLandscape();
- }
- }
- setSplitScreen() {
- if (window.screen.orientation && window.screen.orientation.type !== 'portrait-primary') {
- window.screen.orientation.lock('portrait-primary');
- }
- }
- setLandscape() {
- if (window.screen.orientation && window.screen.orientation.type !== 'landscape-primary') {
- window.screen.orientation.lock('landscape-primary');
- }
- }
- // ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement