Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .spelling
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2.x
5x
accessors
ActivityIndicator
APIs
Expand Down Expand Up @@ -123,4 +124,5 @@ WinGet
WinRT
WinUI
WinUI3
workstream
Xcode
6 changes: 3 additions & 3 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Make sure you have installed all of the [development dependencies](rnw-dependenc

For information around how to set up React Native, see the [React Native Getting Started Guide](https://reactnative.dev/docs/getting-started).

> **Interested in migrating to [React Native's New Architecture](https://reactnative.dev/architecture/landing-page)?** New Architecture support in React Native for Windows is now available to preview in 0.76. Note there are several key changes, so if you’d like to be an early adopter, check out the information in the [New Architecture Guide](new-architecture.md).

## Create a new React Native project

Call the following from the place where you want your project directory to live:
Expand Down Expand Up @@ -70,7 +68,9 @@ Lastly, initialize the React Native for Windows application with the [init-windo
npx react-native init-windows --overwrite
```

> **Note:** RNW templates contain a customized `metro.config.js` file, which is meant to merge cleanly into the default config provided by the standard React Native project template. If you are starting a new app, overwriting `metro.config.js` should have no impact. However, if you are adding Windows to an existing app with an already modified `metro.config.js` file, please make sure to back up and re-apply your modifications after adding RNW.
> **Architecture Note:** The default React Native for Windows template for *new* projects targets [React Native's New Architecture](https://reactnative.dev/architecture/landing-page). For more information, including options for continuing to use the Old Architecture, see [New vs. Old Architecture](new-architecture.md).

> **Metro Note:** React Native Windows overwrites the app project's `metro.config.js` file to enable Windows support. If you are starting a new project, overwriting React Native's default `metro.config.js` should have no impact. However, if you have previously modified your `metro.config.js` file, please make sure to back up and re-apply your modifications after adding React Native Windows.

## Running a React Native Windows App

Expand Down
43 changes: 33 additions & 10 deletions docs/init-windows-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,60 @@ This guide will give you more information on the `init-windows` command of the R

## `init-windows`

The `init-windows` CLI command is used to initialize a new React Native for Windows project inside an existing React Native project.
The `init-windows` CLI command is used to (re-)initialize a new React Native for Windows project inside an existing React Native project.

### Usage
Initializes a new RNW project from a given template.
Initializes a new React Native for Windows project from a given template.

```bat
npx react-native init-windows
```

### Options

Here are the options that `react-native init-windows` takes:

| Option | Input Type | Description |
|-----------------------|------------|--------------------------------------------------|
| `--logging` | boolean | Verbose output logging |
| `--template` | string | Specify the template to use |
| `--template` | string | Specify the template to use (default: `cpp-app`) |
| `--name` | string | The native project name. Defaults to the name property in `app.json` or `package.json` |
| `--namespace` | string | The native project namespace, expressed using dots as separators, i.e. `Level1.Level2.Level3`. Defaults to the same as name |
| `--overwrite` | boolean | Overwrite any existing files without prompting |
| `--no-telemetry` | boolean | Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI |
| `--list` | | Shows a list with all available templates with their descriptions. |
| `-h`, `--help` | boolean | Display help for command |

### Default Options and Re-initializing Projects

After running, the `init-windows` command will save the `name`, `namespace` and `template` configuration in the project's `package.json`:

```json
"react-native-windows": {
"init-windows": {
"name": "MyApp",
"namespace": "MyApp",
"template": "cpp-app"
}
}
```

If you later repeat the `init-windows` command to re-initialize a Windows project, without specifying any of those options, the command will default to any saved values. Among other things, this means you can safely re-run `init-windows` without it automatically changing your project to a different template (i.e. if your project is an Old Architecture app, `init-windows` won't force you to migrate to the New Architecture).

If you *want* to change the value (say, you *do* want to migrate to a new template) just explicitly (re-)specify the option when running `init-windows`.

## Templates

The following templates are available for use with `init-windows` by replacing `--template XYZ`, where `XYZ` can be:
The following templates are available to `init-windows` and can by manually specified with the `--template` option (i.e. `--template cpp-lib`):

| Template | Name | Description |
|:-:|:--|:--|
| `cpp-app` | React Native Windows Application (New Arch, WinAppSDK, C++) | `[Default]` A RNW app using RN's New Architecture, built in C++ and targeting WinAppSDK |
| `cpp-lib` | React Native Windows Library (C++) | A RNW (Turbo) Native Module supporting RN's New and Old Architectures built in C++ |
| `old/uwp-cpp-app` | React Native Windows Application (Old Arch, UWP, C++) | `[Legacy]` A RNW app using RN's Old Architecture, built in C++ and targeting UWP |
| `old/uwp-cs-app` | React Native Windows Application (Old Arch, UWP, C#) | `[Legacy]` A RNW app using RN's Old Architecture, built in C# and targeting UWP |

| Template | Name |
|:-:|:--|
| `cpp-app` | React Native Windows Application (New Arch, WinAppSDK, C++) |
| `cpp-lib` | React Native Windows Library (C++) |
| `old/uwp-cpp-app` | React Native Windows Application (Old Arch, UWP, C++) |
| `old/uwp-cs-app` | React Native Windows Application (Old Arch, UWP, C#) |
> **Architecture Note:** When initializing React Native for Windows for the first time, the `init-windows` CLI command defaults to the `cpp-app` template, which targets [React Native's New Architecture](https://reactnative.dev/architecture/landing-page). For more information, see [New vs. Old Architecture](new-architecture.md).

## Telemetry Notice

Expand Down
Loading