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:- Implementing platform-specific native components
- Providing platform-specific modules and APIs
- Maintaining compatibility with React Native core
- 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
Podfile for VisionOS:
Spatial Components
Creating Custom Platforms
You can create your own out-of-tree platform implementation:Fork React Native core
Start with the React Native core architecture and adapt it for your platform.
Implement platform natives
Create platform-specific implementations of:
- Native components (View, Text, Image, etc.)
- Native modules (AsyncStorage, Networking, etc.)
- JavaScript runtime integration
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
- Abstract Platform Logic: Keep platform-specific code isolated
- Test on All Platforms: Ensure consistent behavior across platforms
- Use Feature Detection: Check for feature availability rather than platform
- Follow Platform Guidelines: Respect each platform’s design patterns
- Monitor Compatibility: Stay updated with React Native core changes
Next Steps
- Configure Android setup
- Set up iOS development
- Learn about performance optimization