Can you use React Native to create a desktop application?
ReactjsReact NativeElectronUniversalReactjs Problem Overview
I'm making a desktop application with create-react-app
and Electron. It needs to run on Mac, Windows and Linux. I also want to make a native version afterwards for Android and iOS.
Can I just make an application in React Native that works on mobile devices and on desktops? It would maybe save a lot of time.
Reactjs Solutions
Solution 1 - Reactjs
Try Proton Native. It uses the React Native syntax for building desktop applications without Electron.
Solution 2 - Reactjs
There isn't any official support for desktop applications in React Native, at least as of January 2018.
There are, however, various experimental forks of React Native for desktop platforms such as react-native-windows for Univeral Windows Platform, react-native-macos for Mac and react-native-desktop for Linux. They're not developed by the main RN team, though, so your milage may vary.
As of July 2021 it unfortunately looks like the only project still being actively being maintained is [react-native-windows] (https://github.com/Microsoft/react-native-windows) the others have been deprecated or straight up abandoned.
Solution 3 - Reactjs
Seems like quit a bit has changed in two years since this post was made. I wanted to give an update.
Currently, these projects going on...
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 Turbolinks - React Native adapter for building hybrid apps with Turbolinks 5.
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
React Native tvOS - adaptation of React Native for Apple tvOS alita - An experimental, comprehensive port of React Native to mini-program(微信小程序).
Proton Native - A wrapper for React Native, using Qt to target Linux, MacOS, and Windows.
All of this directly from the React Native website: https://reactnative.dev/docs/out-of-tree-platforms#docsNav
Solution 4 - Reactjs
Microsoft announced a library for targeting Windows desktop, Xbox, and Windows tablets last week. And the Tech Crunch article on it also links out to an experimental Mac library.
Microsoft launches React Native for Windows
There's also a Qt based library... React Native Desktop
I wouldn't say desktop support is mature, but it's growing.
Solution 5 - Reactjs
Recently I came across this project. Check it out:
I have not used it, but it looks promising and serves to make desktop applications with React.
> Can I just make an application in React Native that works on mobile devices and on desktops? It would maybe save a lot of time.
By the way, if you are looking to create a performant cross-platform application for mobile, desktop, and web from a single codebase, maybe you should try Flutter.
It seems like Proton Native has added support for styling and layouts. You should check that project too. I used it some time ago when it was based on libui, but now is based on its own binding of Qt.
Solution 6 - Reactjs
On Windows the Microsoft team officially added the support of React Native to Windows.
The MacOS part seems to be still a work in progress, but you can find a fork of Facebook/React Native here: https://github.com/microsoft/react-native
Solution 7 - Reactjs
Now Microsoft is fully investing in React Native for Windows which allows you to build applications for all devices supported by Windows 10, including PCs, tablets, 2-in-1 PCs, Xbox, mixed reality devices, etc.
Microsoft React Native also has support for macOS.