Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ReactPage): Removing dependency on ReactPage #1445

Merged
merged 1 commit into from
Oct 17, 2017

Conversation

rozele
Copy link
Collaborator

@rozele rozele commented Oct 13, 2017

ReactPage is not the right abstraction for managing the lifecycle of React Native. In theory, React Native can run from a background state (with no pages involved), or can be embedded into a UserControl / ContentControl to run multiple React instances simultaneously.

This changeset adds ReactNativeHost to manage the lifecycle of the ReactInstanceManager.

@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can do this in a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't CodePush use the ReactPage type as a way to hook in via reflection and do its thing? @pre10der89 brought this up some months ago as a barrier to refactoring in this area.

Copy link
Contributor

Choose a reason for hiding this comment

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

@matthargett your memory is correct... The code push module does take the react page type as a dependency to gain access to the concrete type react instance...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not a firm barrier. CodePush will continue to work for older versions of RNW. For newer versions, it will need to be updated. I'll try to make sure the CodePush update happens before this lands in an official version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This will actually make the CodePush implementation more straightforward.

@rozele rozele force-pushed the host branch 2 times, most recently from f6be28d to 94fae97 Compare October 17, 2017 17:58
@codecov-io
Copy link

codecov-io commented Oct 17, 2017

Codecov Report

Merging #1445 into master will decrease coverage by 0.13%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1445      +/-   ##
==========================================
- Coverage   31.82%   31.69%   -0.14%     
==========================================
  Files         263      266       +3     
  Lines       19078    19160      +82     
  Branches     1589     1597       +8     
==========================================
  Hits         6072     6072              
- Misses      12855    12937      +82     
  Partials      151      151
Impacted Files Coverage Δ
ReactWindows/ReactNative.Shared/ReactNativeHost.cs 0% <0%> (ø)
...ws/ReactNative.Shared/ReactNativeHostExtensions.cs 0% <0%> (ø)
...ndows/ReactNative.Net46/ReactRootViewExtensions.cs 0% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b97ad28...e9ab610. Read the comment docs.

ReactPage is not the right abstraction for managing the lifecycle of React Native. In theory, React Native can run from a background state (with no pages involved), or can be embedded into a UserControl / ContentControl to run multiple React instances simultaneously.

This changeset adds ReactNativeHost to manage the lifecycle of the ReactInstanceManager.
@rozele rozele merged commit 395a156 into microsoft:master Oct 17, 2017
@rozele rozele deleted the host branch October 17, 2017 21:29
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.

4 participants