From 4680e78a28068b96ea3bc5d07bb0b24cae71c2a8 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 15 Jan 2026 16:42:41 -0600 Subject: [PATCH] Add platform vars to env --- src/env/index.ts | 11 +++++++++++ src/env/index.web.ts | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/env/index.ts b/src/env/index.ts index 8558c55b5d..83b644b348 100644 --- a/src/env/index.ts +++ b/src/env/index.ts @@ -1,3 +1,4 @@ +import {Platform} from 'react-native' import {nativeBuildVersion} from 'expo-application' import {BUNDLE_IDENTIFIER, IS_TESTFLIGHT, RELEASE_VERSION} from '#/env/common' @@ -17,3 +18,13 @@ export const APP_VERSION = `${RELEASE_VERSION}.${nativeBuildVersion}` export const APP_METADATA = `${BUNDLE_IDENTIFIER.slice(0, 7)} (${ __DEV__ ? 'dev' : IS_TESTFLIGHT ? 'tf' : 'prod' })` + +/** + * Platform detection + */ +export const IS_IOS = Platform.OS === 'ios' +export const IS_ANDROID = Platform.OS === 'android' +export const IS_NATIVE = true +export const IS_WEB = false +export const IS_WEB_MOBILE = false +export const IS_WEB_MOBILE_IOS = false diff --git a/src/env/index.web.ts b/src/env/index.web.ts index 66087749b7..8426ee212d 100644 --- a/src/env/index.web.ts +++ b/src/env/index.web.ts @@ -13,3 +13,16 @@ export const APP_VERSION = RELEASE_VERSION * The short commit hash and environment of the current bundle. */ export const APP_METADATA = `${BUNDLE_IDENTIFIER.slice(0, 7)} (${__DEV__ ? 'dev' : 'prod'})` + +/** + * Platform detection + */ +export const IS_IOS = false +export const IS_ANDROID = false +export const IS_NATIVE = false +export const IS_WEB = true +// @ts-ignore we know window exists -prf +export const IS_WEB_MOBILE = global.window.matchMedia( + 'only screen and (max-width: 1300px)', +)?.matches +export const IS_WEB_MOBILE_IOS = /iPhone/.test(navigator.userAgent)