Platform module provides information about the platform the app is running on. Use it to implement platform-specific behavior and conditionally render components.
Import
Properties
OS
Returns the current operating system.'ios' | 'android' | 'windows' | 'macos' | 'web'
Version
Returns the OS version.- iOS:
string- iOS version (e.g.,'16.0') - Android:
number- API level (e.g.,33)
constants
Object containing platform-specific constants.forceTouchAvailable(boolean): Whether 3D Touch is availableinterfaceIdiom(string): Device type ('phone','pad','tv','vision')isTesting(boolean): Whether running in test modeisDisableAnimations(boolean): Whether animations are disabledosVersion(string): iOS versionsystemName(string): OS name (e.g.,'iOS')isMacCatalyst(boolean): Whether running on Mac CatalystreactNativeVersion(object): React Native version info
Version(number): Android API levelRelease(string): Android release versionSerial(string): Device serial numberFingerprint(string): Build fingerprintModel(string): Device modelBrand(string): Device brandManufacturer(string): Device manufacturerServerHost(string): Development server host (debug builds)uiMode(string): UI mode ('normal','tv', etc.)isTesting(boolean): Whether running in test modeisDisableAnimations(boolean): Whether animations are disabledreactNativeVersion(object): React Native version info
isPad (iOS only)
Whether the device is an iPad.boolean
isTV
Whether the device is a TV (Apple TV or Android TV).boolean
isVision (iOS only)
Whether the device is Apple Vision Pro.boolean
isTesting
Whether the app is running in test mode.boolean
isDisableAnimations
Whether animations are disabled (for testing or accessibility).boolean
isMacCatalyst (iOS only)
Whether the app is running on Mac via Catalyst.boolean
Methods
select()
Returns the appropriate value for the current platform.object
required
Object with platform-specific values:The method checks keys in order:
ios/android → native → defaultExamples
Basic Platform Detection
Conditional Rendering
Using Platform.select()
Platform-Specific Components
Platform-Specific Code
Android Version Check
Device Type Detection
Platform-Specific File Extensions
Create platform-specific files:Platform-Specific Props
React Native Version Check
Mac Catalyst Detection
Testing Mode Detection
Platform-Specific Styles Pattern
Best Practices
The
Platform.select() method is preferred over if/else statements for cleaner, more maintainable code.