tack-up-now/app/root.tsx

62 lines
1.4 KiB
TypeScript

import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";
import React from "react";
export function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
{children}
<div>Whoah</div>
<ScrollRestoration />
<Scripts />
</body>
</html>
);
}
export default function App() {
const message = isIOS() ? "Hey it's IOS!" : "Oh no"
return <div>{message}</div>
}
function isIOS() {
if (typeof window === "undefined") return false
console.log("User Agent", window.navigator.userAgent)
return [
'iPad Simulator',
'iPhone Simulator',
'iPod Simulator',
'iPad',
'iPhone',
'iPod'
].includes(window.navigator.platform)
// iPad on iOS 13 detection
|| (navigator.userAgent.includes("Mac") && "ontouchend" in document)
}
function iOSversion() {
if (window.indexedDB) { return 'iOS 8 and up'; }
if (window.SpeechSynthesisUtterance) { return 'iOS 7'; }
if ((window as any).webkitAudioContext) { return 'iOS 6'; }
if ((window as any).matchMedia) { return 'iOS 5'; }
if (window.history && 'pushState' in window.history) { return 'iOS 4'; }
return 'iOS 3 or earlier';
}