Out-of-Tree Platforms
React Native is not just for Android and iOS - there are community-supported projects that bring it to other platforms, such as:
- React Native Windows - React Native support for Microsoft's Universal Windows Platform (UWP) and the Windows Presentation Foundation (WPF)
- React Native DOM - An experimental, comprehensive port of React Native to the web. (Not to be confused with React Native Web, which has different goals)
- React Native Desktop - A project aiming to bring React Native to the Desktop with Qt's QML. A fork of React Native Ubuntu, which is no longer maintained.
- React Native macOS - An experimental React Native fork targeting macOS and Cocoa
Creating your own React Native platform
Right now the process of creating a React Native platform from scratch is not very well documented - one of the goals of the upcoming re-architecture (Fabric) is to make maintaining a platform easier.
Bundling
As of React Native 0.57 you can now register your React Native platform with React Native's JavaScript bundler, Metro. This means you can pass --platform example
to react-native bundle
, and it will look for JavaScript files with the .example.js
suffix. To register your platform with RNPM, your module's name must start with a react-native-
suffix. You must also have an entry in your package.json
like this:
{
"rnpm": {
"haste": {
"providesModuleNodeModules": ["react-native-example"],
"platforms": ["example"]
}
}
}
"providesModuleNodeModules"
is an array of modules that will get added to the Haste module search path, and "platforms"
is an array of platform suffixes that will be added as valid platforms.