Disable autoplay by default if prefers-reduced-motion (#3671)

This commit is contained in:
dan
2024-04-24 01:07:18 +01:00
committed by GitHub
parent 0847e2752b
commit 24da3a8f4e
2 changed files with 8 additions and 2 deletions
+6
View File
@@ -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