React Native is a framework developed by Facebook that is used to build the application on native platforms. It is preferred by most developers, due to its speed, agility, and ability to build hybrid applications in multiple platforms with an interactive user interface (UI).
By default, React Native has built-in components and supportive packages, accessible through both the mobile native iOS and Android platforms. To access the applications in the Windows platform, Microsoft developed a Windows extension to React Native.
For more information about the Windows implementation, click here. As exhaustive as this resource may be, many React native developers have a tough time understanding it. So, here is a step-by-step guide on how to set up a React Native application on the Windows platform
1. Create a react-native app with version 0.61.5 or newer.
2. If we support react-native-macOS also, then we need to migrate the react-native-macOS for the version (0.61.5) or newer.
3. Open the terminal and navigate to the React Native project path and execute the command given below to install the react-native-windows.
npx react-native-windows-init
--
overwrite
4. The above command will create a windows folder in the project and the display will be as shown below.
5. Go to the root of the reactnative folder in the terminal and execute the below command to run the react native app in the windows platform.
npx react-native run-windows
or
Using Visual Studio - Open the solution file in the application folder in Visual Studio
(e.g., react_native_windows_support/windows/react_native_windows_support.sln)
6. Open the Visual Studio Installer and modify the components with the options below
In the Workloads tab - Enable the Universal Windows Platform development, Mobile development with C++, Desktop development with C++, and Node.js development support.
In the Individual Components tab - Please enable options as mentioned below.
7. Make sure the target platform version is updated as below from the properties of the project.
8. If the react-native localhost server is not getting triggered automatically, then go to the root of the reactnative folder in the terminal and execute the below command to run the react native localhost manually.
npm start
or
yarn start
After successful installation, the window app will load like below
As per my observation, I have come up with the below list of unsupported react-native community modules and extensions:
Commonly won't support the react-native packages, which does not have the native module support for windows.
https://github.com/IbrahimSulai/react_native_windows_support
For migrating the React Native App to support the macOS platform, please refer to my other blog.