Support React Native Windows - C++/WinRT and C# templates with Example#172
Support React Native Windows - C++/WinRT and C# templates with Example#172BartoszKlonowski wants to merge 14 commits intomainfrom
Conversation
This commit adds the C++ UI Component template with empty class IDL implementation which should act as a starting point for a developer. Full implementation of UI Component for RNW library can be found in the Microsoft's docs.
The template for C++ Native UI component has been refactored: * ReactPackageProvider added so the RNW can automatically link the created FrameworkElement * View and ViewManager scaffolded for better starting point * Solution file fixed - more convenient approach to project architecture and structure * View IDL template does now derive from FrameworkElement This is done mostly for the compilation purposes, but this can also give a better understanding for the developers
The native module template has been refactored: * PCH removed * Native Module header file formatting unified * Project architecture improved
The Windows configuration is based on the C# language - it's easy and simple to understand and has better support when it comes to the UWP documentation. The example is generated for the version 0.63.4 specified in the package.json
|
Love seeing the support for Windows apps being added. Main piece of feedback is that the project files and the code that the template RNW CLI produce, change over time. That is to say, an app created for 0.63 RNW will have different project/code files as 0.64 RNW. We expect we will continue to iterate on the template code and project files as we continue to evolve the platform. Sometimes we also update the template files/projects to backport a severe bugfix. So ideally react-native-builder-bob wouldn't carry these files itself and instead just call the RNW CLI (or somehow "suck up" the files that RNW CLI uses for each version). |
|
@jonthysell to review too |
|
@asklar You've got the point - creating the project through the CLI would prevent us from updating the template and track backports. On the other hand current solution allows to do some customizations to the scaffolded solution, also whole system (each language, platform) is done like this so there's no confusion for a future maintainer, I also believe that the amount of changes required to be done to implement CLI for Windows only would be bigger than the current solution. But I see no problem in keeping your opinion in mind, so perhaps whole system will be based on CLI, not just Windows. |
|
Yes I can see your point; I wouldn't want Windows to be the odd one out that's different : ) I just worry about how RNBB will be able to keep up/know about changes to the templates, but if you guys are comfortable signing up to keep this maintained then I am not concerned :) |
|
@asklar What just came to my mind is that there's one main concern about CLI-based approach: |
|
@asklar @jonthysell Did you take a chance to take a look at .vcxproj and .csproj files? These are essential for the Builder Bob tool to work correctly and your expertise is most valuable here. |
...eact-native-library/templates/example/example/windows/{%- project.name %}Example/App.xaml.cs
Show resolved
Hide resolved
...ve-library/templates/example/example/windows/{%- project.name %}Example/Package.appxmanifest
Outdated
Show resolved
Hide resolved
...te-react-native-library/templates/windows-cpp-library/windows/{%- project.name %}/readme.txt
Outdated
Show resolved
Hide resolved
...act-native-library/templates/windows-cpp-view-library/windows/{%- project.name %}/readme.txt
Outdated
Show resolved
Hide resolved
...ates/windows-cpp-view-library/windows/{%- project.name %}/{%- project.name %}ViewManager.hpp
Outdated
Show resolved
Hide resolved
asklar
left a comment
There was a problem hiding this comment.
Recommend adding CI validation that the apps/libs/modules can be generated properly as well as that they build :)
This commit fixes and covers all review findings of @asklar from Microsoft: - windows-uwp instead of windows for all the template packages name - author.name used for Package.appxmanifes - ViewManager extended with ReactContext and NativeProperties - unnecessary readme.txt files removed
|
What's the state of this? |
|
@satya164 do you have some time for you to review this? |
|
@BartoszKlonowski can you rebase this PR on top of main if you get some time this week? then I'll have time to review and merge this. |
b94e81b to
cf3f675
Compare
|
looking forward to this |
99cfbff to
0775dc9
Compare
7b11914 to
6facf3b
Compare
|
Closing due to inactivity. I'd like to figure out a different way to support other platforms without adding the code to this repo. |
This pull request closes #69
It delivers the full support of React Native Windows project's templates for both C# and C++ languages.
Example project is configured as C# application.
Following changes were implemented:
The 4 new project templates created in the Bob project are created as a 0.63.x projects with React Native Windows dependency already added to the solution configuration.
None of the scaffolded projects use the precompiled headers. All headers required for implementation are included where they are required.
NOTE: Each language has its project's GUID being the same across native module and native UI component.
All projects are provided with the most basic source code file, which should be a starting point for a further implementation.
Though they are basic and do nothing, they still compile successfully for each project.
Those files and classes they implement are named according to the type of project selected.
These basic modules/component are already registered in the ReactPackageProvider.
Please see the short presentation of the full template creation looks like (C# is taken as an example, but the procedure is of course the same for C++/WinRT):
For some more explanations please check the commit messages.