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

fix(detached-loader): completely deatch components #2257

Merged
merged 2 commits into from Sep 21, 2020

Conversation

edusperoni
Copy link
Collaborator

PR Checklist

What is the current behavior?

Detached Loader (DetachedContainer) creates components in place, attaching to a detached ProxyViewContainer and then moving the native views to their appropriate position:

Application
|----AppComponent
|      |---------- Component1
|                       |---------- ListView1
|                       |---------- DetachedContainer (not actually added to the DOM!)
|                                        |---------- ModalView/ListView item/etc (Ng view attached to DetachedContainer, native view attached to modal window/ListView1)

What is the new behavior?

Detached Loader will instantiate components without adding them to the DOM at all, but instead attaching the angular view to the ApplicationRef (enabling change detection). This also fixes issues where modals opened inside a OnPush component would not be CD.

This approach mimics the @angular/cdk approach (portals and DomPortalOutlet).

Application
|----AppComponent
|      |---------- Component1
|                       |---------- ListView1
|                       |---------- DetachedContainer (not actually added to the DOM! Here for compatibility reasons)
|--- ModalView/ListView item/etc (native view attached to modal window/ListView1)

This doesn't fix the root cause of #2256, but should fix most of the issues until the root is fixed (createComponent function of ViewContainerRef).

Fixes #2256.

@project-bot project-bot bot added this to PRs in Plugins Team Sep 20, 2020
@cla-bot cla-bot bot added the cla: yes label Sep 20, 2020
@NathanWalker NathanWalker merged commit 623d2f7 into NativeScript:master Sep 21, 2020
Plugins Team automation moved this from PRs to Done Sep 21, 2020
@bellalMohamed
Copy link
Contributor

Just updated to 10.1.3 and tested, unfortunately it doesn't fix #2256 I'm still facing the same issue

@NathanWalker
Copy link
Contributor

@bellalMohamed that issue was closed by accident upon merging - 10.1.3 only fixes a modal binding issue as well as the ngIf ordering issue - we’re still investigating that final issue with navigation but anticipate it being solved by Tuesday.

@bellalMohamed
Copy link
Contributor

@NathanWalker no worries, what do you think caused this issue?

@edusperoni
Copy link
Collaborator Author

Turns out this is my bad. I forgot to handle the way the component is created using an external factory (

return this.containerRef.createComponent(factory, this.containerRef.length, this.containerRef.injector, null);
).

Oops.

I'll get to it first thing in the morning. The reason modal worked and navigation didn't is because navigation calls that function specifically to create pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Plugins Team
  
Done
Development

Successfully merging this pull request may close these issues.

Two-way data binding stops working after navigation on IOS
3 participants