/** * Instruction to rotate the phone to landscape */ import React, { Component } from "react"; import { isMobile, isiPhone } from "../utils/index.js"; const PhoneIcon = ( ); const RotateIcon = ( ); export default class LandscapeWarning extends Component { constructor(props) { super(props); this.state = { landscape: !isMobile || window.innerWidth > window.innerHeight, }; this.handleResize = this.handleResize.bind(this); if (isMobile) { window.addEventListener("resize", this.handleResize); setTimeout(this.handleResize, 100); } } handleResize() { const landscape = !isMobile || window.innerWidth > window.innerHeight; if (landscape !== this.state.landscape) { this.setState({ landscape }); } } render() { const { landscape } = this.state; if (landscape) return null; return (