Created
December 28, 2018 13:48
-
-
Save orYoffe/d9ab3adb226b561ab05e089b35d33d59 to your computer and use it in GitHub Desktop.
How to tel which env you are on with react native and react native web
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Platform } from 'react-native'; | |
const isWeb = Platform.OS === 'web'; | |
const isNative = !isWeb; | |
const isIos = Platform.OS === 'ios'; | |
const isAndroid = Platform.OS === 'android'; | |
const isDesktop = isWeb && typeof matchMedia !== 'undefined' && matchMedia('(min-width: 768px)').matches; | |
const isMobile = !isDesktop; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment