Move /platform/detection vars into /env (#9707)
* Add platform vars to env * Replace /platform/detection with /env
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
import {Platform} from 'react-native'
|
||||
|
||||
export const isIOS = Platform.OS === 'ios'
|
||||
export const isAndroid = Platform.OS === 'android'
|
||||
export const isNative = isIOS || isAndroid
|
||||
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)
|
||||
@@ -1,26 +0,0 @@
|
||||
import {Linking} from 'react-native'
|
||||
|
||||
import {isNative, isWeb} from './detection'
|
||||
|
||||
export async function getInitialURL(): Promise<string | undefined> {
|
||||
if (isNative) {
|
||||
const url = await Linking.getInitialURL()
|
||||
if (url) {
|
||||
return url
|
||||
}
|
||||
return undefined
|
||||
} else {
|
||||
// @ts-ignore window exists -prf
|
||||
if (window.location.pathname !== '/') {
|
||||
return window.location.pathname
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
export function clearHash() {
|
||||
if (isWeb) {
|
||||
// @ts-ignore window exists -prf
|
||||
window.location.hash = ''
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user