nitro icon indicating copy to clipboard operation
nitro copied to clipboard

[Feature] Support for Windows (react-native-windows)

Open gmacmaster opened this issue 1 year ago • 6 comments

I see mention on iOS and Android in the doc but no mention of RNW.

Is there a way to get this working on windows?

gmacmaster avatar Oct 03 '24 02:10 gmacmaster

Yes, everything is cross-platform so it does work on Windows.

The only thing that we need to change is to get the turbomodule/ autolinked - which is just a single module that acts as an entry point for Nitro.

Nitro only needs reference to the jsi::Runtime and a CallInvoker - that's it.

mrousavy avatar Oct 04 '24 13:10 mrousavy

To add support to another platform, you just need to call margelo::nitro::install(...) in a Runtime. This will install global.NitroModulesProxy into the Runtime's global.

https://github.com/mrousavy/nitro/blob/c0ae25bef6710894c1314f714638b38ca650c66b/packages/react-native-nitro-modules/cpp/entrypoint/InstallNitro.hpp#L16-L29

cc @shirakaba

mrousavy avatar Oct 07 '24 15:10 mrousavy

Here is my writeup of how to write a react-native-windows "attributed" native module (which can be installed as either a NativeModule or TurboModule) that installs a JSI HostObject on the JS global.

I'd help out, but I don't have even a spare half-hour from now until mid-November 🫠

Nitro only needs reference to the jsi::Runtime and a CallInvoker - that's it.

Here is my writeup of how to get access to callinvoker using the above approach.

shirakaba avatar Oct 08 '24 00:10 shirakaba

This is really helpful, thanks Jamie!!

Windows support in Nitro is unfortunately also lower on my priority list for now because of a lot of other things (including VisionCamera stuff), so I don't think I can implement this anytime soon.

If anyone wants to tackle this, I can take time to review PRs and release it though!

mrousavy avatar Oct 08 '24 08:10 mrousavy

this would be useful to look at again with nitro adoption in a bunch of places. will take a look at building a pr based on on the above. bookmarking this. love vision btw ty for the hard work.

kziemski avatar Jul 08 '25 16:07 kziemski

@kziemski , did you have a chance to look into this yet? We're also interested in this development.

juhasuni avatar Aug 07 '25 05:08 juhasuni