Platform Specific Styling

React Native 6 min min read Updated: Jul 26, 2026 Intermediate
Platform Specific Styling
Intermediate Topic 21 of 30

Platform Specific Styling

Android and iOS have different design conventions, and React Native provides the Platform module to apply platform-specific styles and behavior when needed.

Using Platform.OS

The Platform.OS property returns either "ios" or "android", allowing you to conditionally apply different values.

javascript import { Platform } from 'react-native'; const paddingTop = Platform.OS === 'ios' ? 44 : 24;

Using Platform.select

Platform.select provides a cleaner syntax for defining platform-specific values directly within an object.

javascript const styles = StyleSheet.create({ shadow: Platform.select({ ios: { shadowColor: '#000', shadowOpacity: 0.2, shadowRadius: 4, }, android: { elevation: 4, }, }), });

Platform-Specific File Extensions

React Native also supports creating separate files for each platform using .ios.js and .android.js extensions, automatically selecting the correct file at build time.

text Button.ios.js Button.android.js

Handling Shadows Across Platforms

Since iOS uses shadow properties and Android uses elevation for shadows, Platform.select is commonly used to apply the correct shadow implementation for each platform.

Common Platform Differences to Handle

  • Status bar height and safe area insets
  • Shadow rendering (shadow properties vs elevation)
  • Default font families and text rendering
  • Button and touchable feedback styles

Conclusion

Handling platform-specific styling ensures your React Native app feels native and polished on both Android and iOS. Using Platform.OS, Platform.select, and platform-specific file extensions gives you full control over these differences.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators