The first step when getting started with react-native-windows
is to generate the native project for UWP.
Please note, if you are running Windows 10 on a VM (e.g., using Parallels), it is recommended that you re-clone your repo and re-install the node packages on the Windows VM. There will likely be issues with trying to build and run the UWP app from any mapped directory to the host OS.
Using the rnpm-plugin-windows
NPM package and the React Native CLI, generate the UWP native project for your app.
- Install
rnpm-plugin-windows
. - Ensure the React Native CLI,
react-native-cli
is installed globally. - Generate the UWP project with the React Native CLI
windows
command.
Currently, your UWP app will try to run the camera app we've built in the previous lessons. However, we don't have many of these dependencies set up yet.
Rename the App.windows.js
file to App.windows.tsx
and move it to the ./src
directory in the project. This will override the existing App.tsx
file for UWP for the time being. You'll also want to correct the TypeScript syntax:
- Change
import React, { Component } from 'react'
toimport * as React from 'react'
- Change
export default class App extends Component<{}>
toexport default class App extends React.Component
Test the app with the React Native CLI run-windows
command.
- Visual Studio 2017 solution for UWP that runs the default React Native app template.