Platform.OS and Platform.select always return web, how to write platform specific code?

Please provide the following:

  1. SDK Version: 36
  2. Platforms(Android/iOS/web/all): Android/iOS
import { Platform } from 'react-native-web';

I am working on a react native app with web, and I must use Platform.OS and Platform.select in order to right environment specific code.

I am running expo client app on iOS and Android and haven’t builded apk or ipa yet.

I expect Platform to return ios when run from the iPhone and android when run from the Galaxy S9

Instead, I have web, is this unexpected or expected?

How can I write platform specific code ?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.