microsoft / react-native-winrt

Windows Runtime projection for React Native for Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[p0] Update instructions to work out of the box (and simplify usage a bit)

asklar opened this issue · comments

We should simplify usage of react-native-winrt. Here are the steps that cause friction:

  1. Copying the code from the rnwinrt sample into the app project - this is cumbersome, you'd have to clone the rnwinrt repo, or download each file separately. This should come as a either part of the nuget package, or as an npm package.
    P0: put the code (C++ and JS) in an artifact or as part of the nuget package (and apps would just reference the nuget)

  2. The example code hardcodes the path (and version) of the RnWinRT NuGet package:

      <RnWinRTDir>..\packages\Microsoft.ReactNative.WinRT.0.67.20220127.3</RnWinRTDir>

    P0: update usage doc to point people to the right branch

  3. Adding the project and trying to load it throws an error in VS2022:
    image
    P0: Need to remove the packages.config entry from the project, it's already included in the .props file

  4. Specifying which namespaces to project requires editing the vcxproj - which itself requires unloading the project in VS, etc. Instead, these namespaces should be specified in a separate way that is easy to use from JS; you could do this in a json file, and read it from an msbuild target to construct the command line, or pass the path to the json to the generator and have the generator parse the json. You could possibly use the existing package.json to store this information. Alternatively, if we don't want to use json, let's use ExperimentalFlags.props as that's separate from any app project and is just properties / is more easily editable.
    P0: get the list of namespaces from ExperimentalFeatures.props

  5. The sample TurboModule contains a bunch of namespaces to project out; we should call it out in the instructions so it's clear that you are expected to trim this down to what you use.
    P0: update usage doc to mention "you really need to look at this"

  6. Requires creating a js file next to the app - WinRTTurboModule.js - this should be provided by npm package
    P0: Include it in the artifact from 1.