9

So there was this big announcement that you can now write Windows apps using React Native.

The announcement links to a Github page which in turn leads to some description on how to install React Windows

After spending a few hours installing Visual Studio and dependencies, SDKs and whatnot, I've got this "ReactNative" solution built in Visual Studio but I still can't figure out how to even start writing a simple Hello World program.

All the documentation points to how to write Android or iOS programs in Visual Studio Code, but there's no indication on how to write a UWP program.

Does anyone know where to start? What is the Visual Studio equivalent of "react-native init"?

3 Answers 3

5

After you've run react-native init AwesomeProject

cd AwesomeProject
npm i --save-dev rnpm-plugin-windows
react-native windows

This will generate the Visual Studio solution for your project and the index.windows.js entry point. Visual Studio Code is a great tool for editing React Native JavaScript.

To run your app just run react-native run-windows.

0

There is currently no out-of-the-box solution released for UWP Apps with React Native. The only known App with UWP support currently is the F8App, there is a blog post about how they ported it.

0

You are almost there, the answer is at the command line you do "react-native init" - you don't do it through Visual Studio. See https://github.com/ReactWindows/react-native-windows#getting-started

The Visual Studio project creates a UWP project which knows how to load and run react-native js code. The VS code is just a wrapper basically.

To start off a new react native project on windows, open the command line ad do the following:

REM This is the same on Mac or Windows..
react-native init AwesomeProject 

cd AwesomeProject

REM You need to install the react package manager
npm install -g rnpm

REM Add the rnpm-plugin-windows into your package.json
npm install --save-dev rnpm-plugin-windows

REM This will create a "windows" folder in your project folder, 
REM the eqivalent of the ios and android folders.
rnpm windows

REM You will now have a windows folder with a AwesomeProject.sln file
REM You need to start the packager which projects the Javascript bundle to the runtime

react-native start

REM Open the solution in VS and run it, and you will see your app!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.