platform-specific-code

Write platform-specific React Native code for iOS and Android.

2|1|Updated Nov 13, 2025
One-click install
npx skills add https://github.com/MolcajeteAI/plugin --skill platform-specific-code
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: platform-specific-code
Source: https://github.com/MolcajeteAI/plugin/tree/main/deprecated/tech-stacks/js/react-native/skills/platform-specific-code
Command: npx skills add https://github.com/MolcajeteAI/plugin --skill platform-specific-code

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides patterns and best practices for writing code that works seamlessly across both iOS and Android platforms in React Native development, minimizing platform-specific bugs and inconsistencies.

Core Features & Use Cases

  • Platform Detection: Use Platform.OS and Platform.select for conditional logic and styling.
  • Platform-Specific Files: Leverage file naming conventions (e.g., Button.ios.tsx) for distinct implementations.
  • Use Case: When designing a custom button component, use this skill to apply different padding and touch feedback mechanisms for iOS and Android users, ensuring a native feel on each platform.

Quick Start

Use the platform-specific-code skill to implement conditional styling for iOS and Android within your React Native application.

Frequently Asked Questions about platform-specific-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write cross-platform React Native code for iOS and Android?

To write cross-platform React Native code, use the Platform module for conditional logic and styling, or leverage platform-specific file extensions like .ios.tsx and .android.tsx to deliver distinct component implementations for each operating system.

What does Platform.select do in React Native?

Platform.select in React Native allows you to define platform-specific values for styling and component behavior. It automatically resolves the correct property for iOS or Android, ensuring the user interface adapts seamlessly to the underlying operating system.

When should I use platform-specific files in React Native?

Use platform-specific files in React Native when a component requires entirely distinct rendering logic or structures for iOS and Android. Naming files like Button.ios.tsx ensures the bundler loads the correct implementation, maintaining a native feel without cluttering shared code.

What is the best way to apply different styling to iOS and Android in React Native?

The best way to apply different styling is combining Platform.select with your StyleSheet definitions. This approach conditionally delivers platform-specific padding and visual feedback, minimizing inconsistencies and ensuring consistent user experiences across iOS and Android.

Can I detect the operating system in React Native to change component behavior?

Yes, you can detect the operating system using Platform.OS. This returns the current platform string, allowing you to execute conditional logic that adapts component behavior and touch feedback mechanisms specifically for iOS or Android users.

Why does my React Native component look different on iOS and Android?

React Native components look different across iOS and Android due to inherent platform differences in native rendering and interaction patterns. Applying platform-specific code patterns for styling and behavior resolves these inconsistencies and ensures a consistent user experience.