fa6f6f9e47
* Add some comments * Decouple language settings * Normalize on read/write * Refactor * Support device locale on app startup * Cleanup, port to web * Clean up comments * Comment * Try not to mutate * Protect util handling, update test * Dedupe array values
14 lines
569 B
TypeScript
14 lines
569 B
TypeScript
import {Platform} from 'react-native'
|
|
|
|
export const isIOS = Platform.OS === 'ios'
|
|
export const isAndroid = Platform.OS === 'android'
|
|
export const isNative = isIOS || isAndroid
|
|
export const devicePlatform = isIOS ? 'ios' : isAndroid ? 'android' : 'web'
|
|
export const isWeb = !isNative
|
|
export const isMobileWebMediaQuery = 'only screen and (max-width: 1300px)'
|
|
export const isMobileWeb =
|
|
isWeb &&
|
|
// @ts-ignore we know window exists -prf
|
|
global.window.matchMedia(isMobileWebMediaQuery)?.matches
|
|
export const isIPhoneWeb = isWeb && /iPhone/.test(navigator.userAgent)
|