These samples showcase building Native Modules for React Native for Windows. It includes implementations in C# and C++/WinRT.
Both implementations target React Native Windows 0.75.
The official documentation can be found here:
- Native Modules Setup
- Native Modules and React Native Windows
- Native Modules and React Native Windows (Advanced Topics)
- Native UI Components
Note: Don't build your own projects directly out of these samples. When you publish a native module (as source), you'll want to create a new project with the correct metadata. This will also make sure that you're using unique identifiers in your project files (*.csproj/*.vcxproj) to avoid conflicts with other native modules.
First, make sure you've met the React Native Windows System Requirements.
Then, within either the cppwinrt
or csharp
folder, install the module's dependencies. If you have yarn
installed:
yarn install
Otherwise, you can just use npm:
npm install
Once you have all of the dependencies installed, you can build either module with following command (again, run within either the cppwinrt
or csharp
folder):
npx @react-native-community/cli@latest run-windows --no-deploy --no-launch --no-packager --no-autolink --proj "NativeModuleSample\NativeModuleSample.vsproj"
To upgrade either sample to the latest version of RNW, see their individual readme file.