Fix narrow PWA layout on tablet with standalone width rules.
Allow any orientation in manifest, widen content and enable dual-column mode in installed apps on tablet viewports, with iOS display-mode fallback. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
|
||||
/** iOS / iPad PWA 部分版本不识别 display-mode 媒体查询,用 data 属性兜底 */
|
||||
export default function PwaDisplayMode() {
|
||||
useEffect(() => {
|
||||
const standalone =
|
||||
window.matchMedia("(display-mode: standalone)").matches ||
|
||||
(window.navigator as Navigator & { standalone?: boolean }).standalone ===
|
||||
true;
|
||||
|
||||
if (standalone) {
|
||||
document.documentElement.dataset.displayMode = "standalone";
|
||||
}
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user