Files
Kokorone/apps/mobile/lib/reduce-motion.ts
T
jiantw83andClaude Sonnet 5 1bea06e3cd feat(遊戲化): 新增大廳、附身、時間流、後日談進度等遊戲化系統功能
新增角色大廳(lobby)邀約與通話、附身(possession)、時鐘(clock)抽象、
時間流與睡眠負債、後日談進度、行為選擇與旁觀反應等模組,並補齊對應冒煙
測試(R~V)與單元測試;同步調整 web/mobile 對應頁面與元件。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-20 09:10:26 +08:00

27 lines
840 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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;
}