This repository contains a simple React Native module for testing that React Native for Windows >= 0.76.0 can load the same module from both Old and New Architecture apps.
- Make sure you've set up your machine for React Native for Windows development
- Clone this repo to your machine
- Run
yarn
to download dependencies - Run
yarn prepare
to compile the TypeScript
To run the New Architecture (aka. WinAppSDK) example app, run:
yarn example windows
To run the Old Architecture (aka. UWP) example app, run:
yarn example-old windows
If everything worked, you should be running a new app with the text Result: 21
.
The repo contains three node packages:
native-module-sample
: a module which defines a simplemultiply()
method and provides a native Windows implementationexample
: a React Native for Windows app targeting the New Architecture via the Windows App SDKexample-old
: a React Native for Windows app targeting the Old Architecture via the Universal Windows Platform
- Created a new repo using
react-native-create-library
and itsmodule-mixed
template - Simplified the repo by removing the
ios
andandroid
platform implementations - Simplified the repo by removing as many "dev inner-loop" packages as possible
- Added
react-native-windows
as a dependency - Create a new windows implementation via
react-native init-windows --template cpp-lib
- Modified the created code to build the
example
app. - Added the
example-old
app by copying theexample
app and runningreact-native init-windows --template old/uwp-cpp-app