diff options
author | dan <dan.abramov@gmail.com> | 2024-04-24 01:07:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-23 17:07:18 -0700 |
commit | 24da3a8f4e81e0f7694b02545711536414dcd17a (patch) | |
tree | 9d11f269bdb243d752d8e0a060f844c4af7c4916 /src/platform | |
parent | 0847e2752b21b6556a1c9302cebad60bb877c0de (diff) | |
download | voidsky-24da3a8f4e81e0f7694b02545711536414dcd17a.tar.zst |
Disable autoplay by default if prefers-reduced-motion (#3671)
Diffstat (limited to 'src/platform')
-rw-r--r-- | src/platform/detection.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/platform/detection.ts b/src/platform/detection.ts index 150fc1fe3..de4dfc07b 100644 --- a/src/platform/detection.ts +++ b/src/platform/detection.ts @@ -1,5 +1,6 @@ import {Platform} from 'react-native' import {getLocales} from 'expo-localization' + import {dedupArray} from 'lib/functions' export const isIOS = Platform.OS === 'ios' @@ -18,3 +19,8 @@ export const deviceLocales = dedupArray( .map?.(locale => locale.languageCode) .filter(code => typeof code === 'string'), ) as string[] + +export const prefersReducedMotion = + isWeb && + // @ts-ignore we know window exists -prf + !global.window.matchMedia('(prefers-reduced-motion: no-preference)')?.matches |