You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New Native Platform docs describing the cpp-lib template (#1032)
## Description
This PR creates new "Native Platform" docs to capture using the new `cpp-lib` template to add Windows support libraries for both Native Modules and Native Components. This PR also moves the existing "Native Module" docs to a "Legacy Docs" section on the sidebar - each is also given a link to direct devs toward the new docs.
### Why
The current "Native Module" docs may or may not be relevant with the new template - this PR is to move the focus off of those docs (without deleting them just yet) and have clean updated docs that describe how to use the new template.
Resolves#982Resolves#999
## Screenshots
N/A
### Why
The current "Native Module" docs may or may not be relevant with the new
template - this PR is to move the focus off of those docs (without
deleting them just yet) and have clean updated docs that describe how to
use the new template.
Resolves#982Resolves#999
## Screenshots
N/A
---------
Co-authored-by: Tatiana Kapos <tatianakapos@microsoft.com>
Copy file name to clipboardExpand all lines: docs/autolink-windows-cli.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,9 @@ Here are the options that `react-native autolink-windows` takes:
31
31
|`--no-telemetry`| boolean | Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI |
32
32
|`-h`, `--help`| boolean | Display help for command |
33
33
34
-
This sends telemetry to Microsoft by default. You can prevent the telemetry from being sent by using the `--no-telemetry` command line option. See below for more details.
34
+
## Telemetry Notice
35
+
36
+
This command sends telemetry to Microsoft by default. You can prevent the telemetry from being sent by using the `--no-telemetry` command line option. See below for more details.
35
37
36
38
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
Copy file name to clipboardExpand all lines: docs/codegen-windows-cli.md
+45-1Lines changed: 45 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,51 @@ Here are the options that `react-native codegen-windows` takes:
27
27
|`--no-telemetry`| boolean | Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI |
28
28
|`-h`, `--help`| boolean | Display help for command |
29
29
30
-
This sends telemetry to Microsoft by default. You can prevent the telemetry from being sent by using the `--no-telemetry` command line option. See below for more details.
30
+
## Codegen Config
31
+
32
+
The `react-native codegen-windows` command is configured by the `codegenConfig` object in the project's `package.json` file. This `codegenConfig` object is shared by all platforms, but the relevant parts for React Native for Windows is configured as follows:
33
+
34
+
| Field | Type| Description |
35
+
|:------|:---:|:------------|
36
+
|`type`| string |`"modules"` for Native Modules, `"components"` for Native Components, or `"all"` for both |
37
+
|`jsSrcDir`| string | Path to the TypeScript spec input files |
|`namespace`| string | The C++ namespace to contain the generated code |
45
+
|`cppStringType`| string | Optional, the string type to use in C++ code, either `"std::string"` or `std::wstring`. Defaults to `"std::string"`|
46
+
|`generators`| array | Optional, array of codegen generator strings, accepting `"modulesWindows"` for Native Modules, `"componentsWindows"` for Native Components. Defaults to `[ "modulesWindows" ]`|
47
+
|`outputDirectory`| string | Optional, path to place the generated code. Defaults to `./codegen/` of the working directory |
48
+
|`separateDataTypes`| boolean | Optional, specify whether to create separate files to define custom data types. Defaults to `false`|
49
+
50
+
> **Note:** For more information on how to configure the `codegenConfig` object for other platforms, see the [reactnative.dev Configuring Codegen](https://reactnative.dev/docs/the-new-architecture/using-codegen#configuring-codegen) page.
This command sends telemetry to Microsoft by default. You can prevent the telemetry from being sent by using the `--no-telemetry` command line option. See below for more details.
31
75
32
76
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
Copy file name to clipboardExpand all lines: docs/init-windows-cli.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,20 +30,20 @@ Here are the options that `react-native init-windows` takes:
30
30
|`--no-telemetry`| boolean | Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI |
31
31
|`-h`, `--help`| boolean | Display help for command |
32
32
33
-
###Templates
33
+
## Templates
34
34
35
35
The following templates are available for use with `init-windows` by replacing `--template XYZ`, where `XYZ` can be:
36
36
37
37
| Template | Name |
38
38
|:-:|:--|
39
-
|`cpp-app`| React Native Windows Application (New Arch, C++, Win32, Hermes) |
40
-
|`cpp-lib`| React Native Windows Turbo Module (New Arch, C++) |
39
+
|`cpp-app`| React Native Windows Application (New Arch, WinAppSDK, C++) |
40
+
|`cpp-lib`| React Native Windows Library (C++) |
41
41
|`old/uwp-cpp-app`| React Native Windows Application (Old Arch, UWP, C++) |
42
-
|`old/uwp-cpp-lib`| React Native Windows Library (Old Arch, UWP, C++) |
43
42
|`old/uwp-cs-app`| React Native Windows Application (Old Arch, UWP, C#) |
44
-
|`old/uwp-cs-lib`| React Native Windows Library (Old Arch, UWP, C#) |
45
43
46
-
This sends telemetry to Microsoft by default. You can prevent the telemetry from being sent by using the `--no-telemetry` command line option. See below for more details.
44
+
## Telemetry Notice
45
+
46
+
This command sends telemetry to Microsoft by default. You can prevent the telemetry from being sent by using the `--no-telemetry` command line option. See below for more details.
47
47
48
48
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
Copy file name to clipboardExpand all lines: docs/native-code-language-choice.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,11 @@ title: Choosing C++ or C# for native code
7
7
8
8
> **Architecture Review Needed:** This documentation was written to support development against React Native's "Old" or "Legacy" Architecture. It *may or may not* be directly applicable to New Architecture development and needs to be reviewed and potentially updated. For information on React Native architectures in React Native Windows, see [New vs. Old Architecture](new-architecture.md).
9
9
10
+
> For the latest information on native development on Windows, see [Native Platform: Overview](native-platform.md).
11
+
10
12
React Native for Windows supports writing native code in both C++ and C#, but there are trade-offs with each language. The choice of language can impact the compatibility, developer experience, and performance of your project. So whether you're building an app or native module, you should choose the native language that best meets your requirements.
11
13
12
-
> **Note**: In this document, C++ refers specifically to C++/WinRT.
14
+
> **Note:** In this document, C++ refers specifically to C++/WinRT.
Copy file name to clipboardExpand all lines: docs/native-code.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@ title: Working with native code on Windows
7
7
8
8
> **Architecture Review Needed:** This documentation was written to support development against React Native's "Old" or "Legacy" Architecture. It *may or may not* be directly applicable to New Architecture development and needs to be reviewed and potentially updated. For information on React Native architectures in React Native Windows, see [New vs. Old Architecture](new-architecture.md).
9
9
10
+
> For the latest information on native development on Windows, see [Native Platform: Overview](native-platform.md).
11
+
10
12
## What is a React Native for Windows app?
11
13
12
14
When you create a React Native for Windows app targeting React Native's old architecture, you will get a [Universal Windows Platform app](https://docs.microsoft.com/windows/uwp/get-started/universal-application-platform-guide) (aka UWP app).
Copy file name to clipboardExpand all lines: docs/native-modules-advanced.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@ title: Native Modules (Advanced)
7
7
8
8
> **Architecture Review Needed:** This documentation was written to support development against React Native's "Old" or "Legacy" Architecture. It *may or may not* be directly applicable to New Architecture development and needs to be reviewed and potentially updated. For information on React Native architectures in React Native Windows, see [New vs. Old Architecture](new-architecture.md).
9
9
10
+
> For the latest information on native development on Windows, see [Native Platform: Overview](native-platform.md).
11
+
10
12
>**This documentation and the underlying platform code is a work in progress.**
11
13
>**Examples (C# and C++/WinRT):**
12
14
> -[Native Module Sample in `microsoft/react-native-windows-samples`](https://github.com/microsoft/react-native-windows-samples/tree/main/samples-old/NativeModuleSample)
Copy file name to clipboardExpand all lines: docs/native-modules-async.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@ title: Using Asynchronous Windows APIs
7
7
8
8
> **Architecture Review Needed:** This documentation was written to support development against React Native's "Old" or "Legacy" Architecture. It *may or may not* be directly applicable to New Architecture development and needs to be reviewed and potentially updated. For information on React Native architectures in React Native Windows, see [New vs. Old Architecture](new-architecture.md).
9
9
10
+
> For the latest information on native development on Windows, see [Native Platform: Overview](native-platform.md).
11
+
10
12
>**This documentation and the underlying platform code is a work in progress.**
11
13
12
14
A common scenario for [Native Modules](native-modules.md) is to call one or more native asynchronous methods from a JS asynchronous method. However it may not be immediately obvious how to properly bridge both asynchronous worlds, which can lead to unstable, difficult to debug code.
Copy file name to clipboardExpand all lines: docs/native-modules-autolinking.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@ title: Autolinking Native Modules
7
7
8
8
> **Architecture Review Needed:** This documentation was written to support development against React Native's "Old" or "Legacy" Architecture. It *may or may not* be directly applicable to New Architecture development and needs to be reviewed and potentially updated. For information on React Native architectures in React Native Windows, see [New vs. Old Architecture](new-architecture.md).
9
9
10
+
> For the latest information on native development on Windows, see [Native Platform: Overview](native-platform.md).
11
+
10
12
Autolinking is a mechanism that allows your React Native app project to discover and use native modules and view managers provided by React Native libraries.
11
13
12
14
This document covers autolinking for the Windows platform. It is an extension to the [React Native CLI Autolinking doc](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md).
0 commit comments