Skip to content
Discussion options

You must be logged in to vote

Figured it out. For anyone in need (React):

app.tsx

useEffect(() => {
if (
	window.matchMedia &&
	window.matchMedia('(display-mode: standalone)').matches
) {
	document.documentElement.classList.add('pwa');
} else {
	document.documentElement.classList.remove('pwa');
}
}, []);

tailwind.config

plugin(({ addVariant, e }) => {
addVariant('pwa', ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
    return `.pwa .${e(`pwa${separator}${className}`)}`;
    });
});
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@simonswiss
Comment options

Answer selected by Paxatax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants