UNPKG

769 BJavaScriptView Raw
1'use strict';
2
3import { isWeb, isWindowAvailable } from "./PlatformChecker.js";
4import { makeMutable } from "./mutables.js";
5export function isReducedMotionEnabledInSystem() {
6 return isWeb() ? isWindowAvailable() ?
7 // @ts-ignore Fallback if `window` is undefined.
8 window.matchMedia('(prefers-reduced-motion: reduce)').matches : false : !!global._REANIMATED_IS_REDUCED_MOTION;
9}
10const IS_REDUCED_MOTION_ENABLED_IN_SYSTEM = isReducedMotionEnabledInSystem();
11export const ReducedMotionManager = {
12 jsValue: IS_REDUCED_MOTION_ENABLED_IN_SYSTEM,
13 uiValue: makeMutable(IS_REDUCED_MOTION_ENABLED_IN_SYSTEM),
14 setEnabled(value) {
15 ReducedMotionManager.jsValue = value;
16 ReducedMotionManager.uiValue.value = value;
17 }
18};
19//# sourceMappingURL=ReducedMotion.js.map
\No newline at end of file