react-native-reanimated
Version:
More powerful alternative to Animated library for React Native.
19 lines (18 loc) • 768 B
JavaScript
import { IS_WEB, IS_WINDOW_AVAILABLE } from "./common/index.js";
import { makeMutable } from "./mutables.js";
export function isReducedMotionEnabledInSystem() {
return IS_WEB ? IS_WINDOW_AVAILABLE ?
// @ts-ignore Fallback if `window` is undefined.
window.matchMedia('(prefers-reduced-motion: reduce)').matches : false : !!global._REANIMATED_IS_REDUCED_MOTION;
}
const IS_REDUCED_MOTION_ENABLED_IN_SYSTEM = isReducedMotionEnabledInSystem();
export const ReducedMotionManager = {
jsValue: IS_REDUCED_MOTION_ENABLED_IN_SYSTEM,
uiValue: makeMutable(IS_REDUCED_MOTION_ENABLED_IN_SYSTEM),
setEnabled(value) {
ReducedMotionManager.jsValue = value;
ReducedMotionManager.uiValue.value = value;
}
};
//# sourceMappingURL=ReducedMotion.js.map
;