Created
October 26, 2022 15:49
-
-
Save polluterofminds/7b64baa030c4691478d927fdc41e3bba to your computer and use it in GitHub Desktop.
Appjections Mobile View
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from 'react' | |
import InstallScreen from "./InstallScreen"; | |
import AppContainer from "./AppContainer"; | |
const MobileView = () => { | |
const [standaloneMode, setStandaloneMode] = useState(false); | |
useEffect(() => { | |
let standalone = false; | |
if (window.matchMedia("(display-mode: standalone)").matches) { | |
standalone = true; | |
} | |
setStandaloneMode(standalone); | |
}, []); | |
if(standaloneMode) { | |
return ( | |
<AppContainer /> | |
) | |
} else { | |
return ( | |
<InstallScreen /> | |
) | |
} | |
} | |
export default MobileView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment