how can i check if my react native app is running in a web browser or running in a android app?

import { Platform } from 'react-native';

if (Platform.OS === 'ios') {
  // do something for ios
} else if (Platform.OS === 'android') {
  // other thing for android
} else if (Platform.OS === 'web') {
  // it's on web!
} else {
  // you probably won't end up here unless you support another platform!

I would recommend following the full tutorial provided at the start of the Expo docs, the Handling platform differences section covers this and you may learn other valuable information from the other sections.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top