jutsu-react-native:react-native-platform

Identify and manage platform-specific code paths in React Native apps.

187|20|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/TheBushidoCollective/han --skill jutsu-react-native-react-native-platform
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jutsu-react-native:react-native-platform
Source: https://github.com/TheBushidoCollective/han/tree/main/jutsu/jutsu-react-native/skills/react-native-platform
Command: npx skills add https://github.com/TheBushidoCollective/han --skill jutsu-react-native-react-native-platform

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill covers handling platform-specific code in React Native for iOS and Android, including Platform API usage and cross-platform best practices.

Core Features & Use Cases

  • Platform detection: Platform.OS with platform-specific logic.
  • Platform-specific files: iOS vs Android implementations.
  • Cross-platform patterns: Shared components with platform-specific tweaks.

Quick Start

Create a Button component with Button.ios.tsx and Button.android.tsx and a shared fallback Button.tsx.

Frequently Asked Questions about jutsu-react-native:react-native-platform

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

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

Use React Native's Platform API to detect the OS and conditionally execute code paths. Platform.OS returns 'ios' or 'android', allowing you to branch logic, import platform-specific modules, or use Platform.select() to return platform-specific values in a single expression.

Can I create separate iOS and Android implementations of the same component?

Yes. React Native supports platform-specific file extensions: name your files Component.ios.tsx and Component.android.tsx, then import Component generically. The bundler automatically selects the correct file. Provide a shared Component.tsx as a fallback for unsupported platforms.

What's the best way to handle platform-specific files and components in React Native?

Use file naming conventions (Component.ios.tsx, Component.android.tsx) for complete platform divergence, or use Platform.select() within a single file for minor differences. Combine these patterns: platform-specific files for substantial differences, Platform.select() for tweaks to shared logic.

How do I access native modules and handle permissions differently on each platform?

Import platform-specific native modules using the same file-naming convention as components. Wrap permission requests in Platform.OS checks to call iOS-specific APIs (e.g., requestCamera) or Android equivalents, respecting each platform's permission model and safe-area requirements.

Why does my Android back-button behavior differ from iOS navigation?

Android's hardware back button requires explicit handling via Platform.OS checks or the BackHandler API, while iOS relies on gesture-based navigation. Detect Platform.OS === 'android' and configure back-button logic separately to prevent unintended app exits.

What are common pitfalls when writing cross-platform React Native code?

Avoid hardcoding platform assumptions in shared components. Use Platform.OS consistently for detection, test both platforms thoroughly, and remember that safe areas, permission flows, and navigation patterns differ significantly between iOS and Android.