新增角色大廳(lobby)邀約與通話、附身(possession)、時鐘(clock)抽象、 時間流與睡眠負債、後日談進度、行為選擇與旁觀反應等模組,並補齊對應冒煙 測試(R~V)與單元測試;同步調整 web/mobile 對應頁面與元件。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
27 lines
840 B
TypeScript
27 lines
840 B
TypeScript
import { useEffect, useState } from "react";
|
||
import { AccessibilityInfo } from "react-native";
|
||
|
||
// Q-4:對應 apps/web 的 `prefers-reduced-motion`,兩處視覺母題動畫(HeartbeatWave/HeartbeatDot)
|
||
// 都要在系統開啟「減少動態」時關閉動畫,改為靜態呈現。
|
||
export function useReduceMotion(): boolean {
|
||
const [reduceMotion, setReduceMotion] = useState(false);
|
||
|
||
useEffect(() => {
|
||
let mounted = true;
|
||
AccessibilityInfo.isReduceMotionEnabled().then((enabled) => {
|
||
if (mounted) {
|
||
setReduceMotion(enabled);
|
||
}
|
||
});
|
||
const subscription = AccessibilityInfo.addEventListener("reduceMotionChanged", (enabled: boolean) => {
|
||
setReduceMotion(enabled);
|
||
});
|
||
return () => {
|
||
mounted = false;
|
||
subscription.remove();
|
||
};
|
||
}, []);
|
||
|
||
return reduceMotion;
|
||
}
|