Skip to content

Update lib to react-native-windows 0.82 new arch#138

Merged
birdofpreyru merged 1 commit into
birdofpreyru:masterfrom
hsjoberg:rnw-newarch
Mar 30, 2026
Merged

Update lib to react-native-windows 0.82 new arch#138
birdofpreyru merged 1 commit into
birdofpreyru:masterfrom
hsjoberg:rnw-newarch

Conversation

@hsjoberg

@hsjoberg hsjoberg commented Mar 27, 2026

Copy link
Copy Markdown

Hi, this PR migrates Windows to rnw new arch.
Old arch support was removed upstream in rnw 0.82, so this change only targets new arch.
As we know, rnw drifted behind core react-native, but I've kept react-native itself at 0.84.

What changed

  • Aligned Windows lib and example project to rnw's cpp-lib/cpp-app scaffolding
  • Three changes were needed to the TurboModule code itself (ReactNativeModule.cpp):
    • Initialize file/folder pickers with IInitializeWithWindow
    • Make MainBundlePath safe for unpackaged apps
    • Preserve UTF-8 when converting unpackaged Windows paths
  • Fixed example Metro config so rnw build/target outputs are properly blacklisted on Windows
  • Disabled @dr.pogodin/react-native-static-server on Windows only in the example app for now, as that lib also needs migration
  • Set hermesV1Enabled=true in the Android example so Hermes resolves correctly with react-native 0.84
  • Changed the pickFile() button to blue because it was otherwise invisible on rnw

Verification

  • Windows example builds (with yarn example windows)
  • Android example still builds
  • iOS example still builds

Note

First time building fails with

 √ Found Solution: C:\Users\CocoT1\Projects\react-native-fs\example\windows\ReactNativeFsExample.sln
 i Build configuration: Debug
 i Build platform: x64
 × Building Solution: ReactNativeFsExample.Package -> obj\x64\Debug\Symbols\ReactNativeFsExample.Package_1.0.0.0_...
 × Build failed with message 3:7>C:\Users\CocoT1\.nuget\packages\microsoft.windows.cppwinrt\2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.targets(228,13): error MSB4006: There is a circular dependency in the target dependency graph involving target "CppWinRTComputeGetResolvedWinMD". [C:\Users\CocoT1\Projects\react-native-fs\example\windows\ReactNativeFsExample\ReactNativeFsExample.vcxproj]. Check your build configuration.
Command failed. Re-run the command with --logging for more information.

Just build again and should work. More info: microsoft/react-native-windows#15747.

Closes #123, #116

As of react-native-windows 0.82, support for old arch has been
dropped. This commit updates the lib and the example app to new
architecture.

@birdofpreyru birdofpreyru left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hsjoberg !

Visually, just looking at the PR, it all looks good to me. I had just a few comments, I can correct all the stuff mentioned myself, if you don't feel strong about any of my points, and don't explain me why it should be different.

I'll merge / test the build / release the new lib versions within the next few days.

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
hermesEnabled=true
hermesV1Enabled=true

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need it? I don't think I had any problems without it, and RN docs for v0.84 tell Hermes V1 is the default with no need for any config changes?

https://reactnative.dev/blog/2026/02/11/react-native-0.84#hermes-v1-as-default

@hsjoberg hsjoberg Mar 27, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is mysterious yes as Hermes V1 is the default now.
However, I ran into gradle dependencies issues without setting this flag explicitly.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all dependencies for configuration ':app:debugCompileClasspath'.
   > Could not find com.facebook.react:hermes-android:0.84.0.
     Required by:
         project ':app'

I guess if it works for you in the example app without then should be fine. Maybe some local machine shenanigans.

I can dig deeper on this one if you want.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like build problems on Android without this flag were caused by having react-native-windows@0.82 installed alongside react-native@0.84. Gonna remove react-native-windows for now from all package.json files, so that it does not mess anything on other platforms, and to run the example on Windows it will be necessary to install it explicitly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Yeah that's reasonable.
Hopefully react-native-windows gets up-to-date soon.

}
},
'stopUpload() should stop an upload process [iOS]': async () => {
if (Platform.OS === 'windows') return Result.notAvailable('windows');

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, this is effectively covered by the next line? Also the argument(s) of .notAvailable() is (are) the platforms where the feature is available / test should work; so to get correct error messages, all previous instance of .notAvailable() you added should have different arguments (and probably, it is a good idea for me to do something with that helper function to be less confusing).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point this is silly. No need.

Comment thread example/src/testServer.ts
Comment on lines +31 to +33
const Server = require(
'@dr.pogodin/react-native-static-server',
).default as typeof import('@dr.pogodin/react-native-static-server').default;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... wouldn't it work with just?

const Server = await import('@dr.pogodin/react-native-static-server');

@hsjoberg hsjoberg Mar 27, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is enough yes, however adding as typeof import('@dr.pogodin/react-native-static-server').default; gave type info (any otherwise for me).

Comment thread package.json
"react": "19.2.3",
"react-native": "0.84.0",
"react-native-builder-bob": "^0.40.18",
"react-native-windows": "0.82.0",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer to not include react-native-windows as the dependency into the main package.json... if it is really needed on that level, it should be a dev dependency. Many RN devs only do Android / iOS, and don't want to automatically install with the library rnw and its transient dependencies, unnecessary for them. Also, because rnw lags behind the main rn, with some mismatching versions pairs in past I so some weird dependency conflicts, and somewhat confusing build failures for other platforms.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in devDependencies actually, not dependencies.
I think we need this one there for running windows codegen.

@hsjoberg

Copy link
Copy Markdown
Author

Thank you for the review @birdofpreyru.

I can correct all the stuff mentioned myself, if you don't feel strong about any of my points, and don't explain me why it should be different.

Sure all good by me.

@birdofpreyru
birdofpreyru merged commit fd3753b into birdofpreyru:master Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] Pending upgrade to RN version above 0.80

2 participants