Skip to content

Conversation

@vmoroz
Copy link
Member

@vmoroz vmoroz commented Apr 26, 2020

As we work on the C++ TurboModules, we want this design to be applicable for the generic C++ code and not just C++/WinRT. During the latest TurboModule design review with @acoates-ms he has noticed that the only required use of the C++/WinRT interfaces in the user-written TurboModule code is the new Initialize method with the REACT_INIT attribute. In all other places we already use abstractions such as ReactConstantProvider, ReactPromise, ReactError, etc.

In this change we add the new ReactContext into the Microsoft.ReactNative.Cxx shared code:

  • It wraps up the IReactContext
  • It adds convenience templated methods that directly accept JS function or event arguments. Internally they create the JSValueArgWriter delegate with help of the new MakeJSValueArgWriter method.
  • Its use for the Initialize method is similar to the use of the ReactConstantProvider for the constant provider methods.

Note that it is a breaking change for any code that already started to use the REACT_INIT attribute for Native Modules. After this PR is merged, all code must be changed to use the ReactContext struct instead of the IReactContext interface. The REACT_INIT is a new attribute in RNW 0.62 and the change must have low impact on existing code.

Microsoft Reviewers: Open in CodeFlow

@vmoroz vmoroz added the Breaking Change This PR will break existing apps and should be part of the known breaking changes for the release label Apr 26, 2020
@vmoroz vmoroz requested review from a team, acoates-ms and jonthysell April 26, 2020 15:56
@vmoroz vmoroz requested a review from a team as a code owner April 26, 2020 15:56
@NickGerleman
Copy link
Contributor

Going to merge this in so we can have it in the initial 0.62 preview and not deal with it ad a breaking change.

@NickGerleman NickGerleman added the AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) label Apr 26, 2020
@ghost
Copy link

ghost commented Apr 26, 2020

Hello @NickGerleman!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 1c83c38 into microsoft:master Apr 26, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) Breaking Change This PR will break existing apps and should be part of the known breaking changes for the release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants