Skip to main content

Out-of-Tree Platforms

React Native supports platforms beyond iOS and Android through out-of-tree platform implementations. These platforms are maintained separately from the core React Native repository.

Supported Out-of-Tree Platforms

React Native can run on multiple platforms:
  • Windows - React Native for Windows
  • macOS - React Native for macOS
  • Web - React Native Web
  • Android TV - TV-specific Android implementation
  • tvOS - Apple TV platform
  • VisionOS - Apple Vision Pro

Architecture Overview

Out-of-tree platforms work by:
  1. Implementing platform-specific native components
  2. Providing platform-specific modules and APIs
  3. Maintaining compatibility with React Native core
  4. Supporting the same JavaScript API surface

React Native for Windows

Run React Native apps on Windows 10+ and Windows 11.

Installation

Requirements

  • Windows 10 version 1809 (build 17763) or higher
  • Visual Studio 2022 with UWP workload
  • Node.js
  • React Native CLI

Running on Windows

Platform-Specific Code

React Native for macOS

Build native macOS applications using React Native.

Installation

Requirements

  • macOS 10.15 (Catalina) or higher
  • Xcode 13 or higher
  • CocoaPods
  • Node.js

Running on macOS

Podspec Configuration

macOS apps use similar Podspec configuration to iOS:

React Native Web

Run React Native apps in web browsers.

Installation

Webpack Configuration

Web-Specific Components

TV Platforms (tvOS and Android TV)

Build apps for television platforms.

Platform Detection

Focus Management

TV apps require focus management:

Remote Control Events

VisionOS (Apple Vision Pro)

Build spatial computing apps for Apple Vision Pro.

Setup

Update Podfile for VisionOS:

Spatial Components

Creating Custom Platforms

You can create your own out-of-tree platform implementation:
1

Fork React Native core

Start with the React Native core architecture and adapt it for your platform.
2

Implement platform natives

Create platform-specific implementations of:
  • Native components (View, Text, Image, etc.)
  • Native modules (AsyncStorage, Networking, etc.)
  • JavaScript runtime integration
3

Create build tooling

Develop build scripts and configuration for your platform:
4

Maintain compatibility

Keep your platform up-to-date with React Native core releases.

Platform-Specific Code Patterns

Using Platform Module

File Extensions

Use platform-specific file extensions:

Platform Version Checking

Native Dependencies

Out-of-tree platforms may require platform-specific dependencies:

Community Resources

Best Practices

  1. Abstract Platform Logic: Keep platform-specific code isolated
  2. Test on All Platforms: Ensure consistent behavior across platforms
  3. Use Feature Detection: Check for feature availability rather than platform
  4. Follow Platform Guidelines: Respect each platform’s design patterns
  5. Monitor Compatibility: Stay updated with React Native core changes

Next Steps