Skip to content

Upgrade Native Modules Apps to 0.80.0 #1060

@anupriya13

Description

@anupriya13

Refer to this PR for reference:https://github.com/microsoft/react-native-windows-samples/pull/1062/files

Update all package.json files under the Native Modules directory to use react-native-windows@0.80.0. The diff should be similar to the above PR but scoped only to Native Modules.

Below instructions can help you complete this task:

  • yarn install
  • yarn prepare

To run the app yarn example windows

First run the Setup steps above. Then run the UpgradeSmokeTest.ps1 script with the target RNW version (usually latest):
.......github\scripts\UpgradeSmokeTest.ps1 latest $True $True $True
Then call the following to update the JS and codegen with:

	yarn prepare	
	yarn codegen-windows

Finally, build and verify both example apps as per the Run steps above. If both apps work without issue, then go ahead and submit the PR with your changes.

If you get this error:

Building Solution: C:\Users\hmalothu\.nuget\packages\microsoft.reactnative.cxx\0.79.0\build\native\Microsoft.R...
 × Build failed with message 3:10>C:\Users\hmalothu\.nuget\packages\microsoft.reactnative.cxx\0.79.0\build\native\Microsoft.ReactNative.VersionCheck.targets(96,5): error : Mismatch detected between npm package versions and nuget package version. [G:\react-native-windows-samples\samples\NativeModuleSample\cpp-lib\windows\NativeModuleSample\NativeModuleSample.vcxproj]. Check your build configuration.

What to do?
change your package reference in nativemodulesample.vcxproj and  nativemodulesampleexample.vcxproj

<ItemGroup>
    <PackageReference Include="Microsoft.ReactNative">
      <Version>0.80.0</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.ReactNative.Cxx">
      <Version>0.80.0</Version>
    </PackageReference>

If you get these kind of errors

Error: Unable to resolve module ./Libraries/Utilities/warnOnce from G:\react-native-windows-samples\samples\NativeModuleSample\cpp-lib\example\node_modules\react-native-windows\index.windows.js:

None of these files exist:

node_modules\react-native-windows\Libraries\Utilities\warnOnce(.windows.js|.native.js|.js|.windows.jsx|.native.jsx|.jsx|.windows.json|.native.json|.json|.windows.ts|.native.ts|.ts|.windows.tsx|.native.tsx|.tsx)
node_modules\react-native-windows\Libraries\Utilities\warnOnce
110 | // Windows]]
111 |
112 | const warnOnce = require('./Libraries/Utilities/warnOnce').default;
| ^
113 | const invariant = require('invariant');

what to do?
npx react-native start --reset-cacheCorrupted modules: Sometimes npm packages can get corrupted during installation, causing module resolution issue

Metadata

Metadata

Labels

Workstream: Gallery and SamplesHave useful samples of RNW app and library projects to help developers.enhancementNew feature or request

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions