mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import {Platform} from 'react-native'
2import {isReducedMotion} from 'react-native-reanimated'
3import {getLocales} from 'expo-localization'
4
5import {dedupArray} from 'lib/functions'
6
7export const isIOS = Platform.OS === 'ios'
8export const isAndroid = Platform.OS === 'android'
9export const isNative = isIOS || isAndroid
10export const devicePlatform = isIOS ? 'ios' : isAndroid ? 'android' : 'web'
11export const isWeb = !isNative
12export const isMobileWebMediaQuery = 'only screen and (max-width: 1300px)'
13export const isMobileWeb =
14 isWeb &&
15 // @ts-ignore we know window exists -prf
16 global.window.matchMedia(isMobileWebMediaQuery)?.matches
17
18export const deviceLocales = dedupArray(
19 getLocales?.()
20 .map?.(locale => locale.languageCode)
21 .filter(code => typeof code === 'string'),
22) as string[]
23
24export const prefersReducedMotion = isReducedMotion()