Move /platform/detection vars into /env (#9707)

* Add platform vars to env

* Replace /platform/detection with /env
This commit is contained in:
Eric Bailey
2026-01-16 16:28:17 -06:00
committed by GitHub
parent bd510d8468
commit 0589bd7d9e
244 changed files with 789 additions and 789 deletions
+5 -5
View File
@@ -10,7 +10,6 @@ import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import flattenReactChildren from 'react-keyed-flatten-children'
import {isAndroid, isIOS, isNative} from '#/platform/detection'
import {atoms as a, useTheme} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
@@ -30,6 +29,7 @@ import {
type TriggerProps,
} from '#/components/Menu/types'
import {Text} from '#/components/Typography'
import {IS_ANDROID, IS_IOS, IS_NATIVE} from '#/env'
export {
type DialogControlProps as MenuControlProps,
@@ -70,7 +70,7 @@ export function Trigger({
} = useInteractionState()
return children({
isNative: true,
IS_NATIVE: true,
control: context.control,
state: {
hovered: false,
@@ -111,7 +111,7 @@ export function Outer({
<Dialog.ScrollableInner label={_(msg`Menu`)}>
<View style={[a.gap_lg]}>
{children}
{isNative && showCancel && <Cancel />}
{IS_NATIVE && showCancel && <Cancel />}
</View>
</Dialog.ScrollableInner>
</Context.Provider>
@@ -137,13 +137,13 @@ export function Item({children, label, style, onPress, ...rest}: ItemProps) {
onFocus={onFocus}
onBlur={onBlur}
onPress={async e => {
if (isAndroid) {
if (IS_ANDROID) {
/**
* Below fix for iOS doesn't work for Android, this does.
*/
onPress?.(e)
context.control.close()
} else if (isIOS) {
} else if (IS_IOS) {
/**
* Fixes a subtle bug on iOS
* {@link https://github.com/bluesky-social/social-app/pull/5849/files#diff-de516ef5e7bd9840cd639213301df38cf03acfcad5bda85a1d63efd249ba79deL124-L127}
+1 -1
View File
@@ -138,7 +138,7 @@ export function Trigger({
<RadixTriggerPassThrough>
{props =>
children({
isNative: false,
IS_NATIVE: false,
control,
state: {
hovered,
+2 -2
View File
@@ -43,7 +43,7 @@ export type TriggerProps = {
}
export type TriggerChildProps =
| {
isNative: true
IS_NATIVE: true
control: Dialog.DialogOuterProps['control']
state: {
/**
@@ -73,7 +73,7 @@ export type TriggerChildProps =
}
}
| {
isNative: false
IS_NATIVE: false
control: Dialog.DialogOuterProps['control']
state: {
hovered: boolean