Skip to content

fix: use changeDetectorRef.detectChanges() instead of detectChanges() private api #99

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

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/angular/src/lib/cdk/dialog/native-modal-ref.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ApplicationRef, ComponentFactoryResolver, ComponentRef, EmbeddedViewRef, Injector, Optional, ViewContainerRef, ɵdetectChanges as detectChanges } from '@angular/core';
import { ContentView, View, Application, Frame } from '@nativescript/core';
import { ApplicationRef, ComponentFactoryResolver, ComponentRef, EmbeddedViewRef, Injector, Optional, ViewContainerRef } from '@angular/core';
import { Application, ContentView, Frame, View } from '@nativescript/core';
import { fromEvent, Subject } from 'rxjs';
import { take } from 'rxjs/operators';
import { AppHostAsyncView, AppHostView } from '../../app-host-view';
import { NSLocationStrategy } from '../../legacy/router/ns-location-strategy';
import { once } from '../../utils/general';
import { NgViewRef } from '../../view-refs';
import { DetachedLoader } from '../detached-loader';
import { ComponentPortal, TemplatePortal } from '../portal/common';
import { NativeScriptDomPortalOutlet } from '../portal/nsdom-portal-outlet';
import { NativeDialogConfig } from './dialog-config';
import { NgViewRef } from '../../view-refs';

export class NativeModalRef {
_id: string;
Expand Down Expand Up @@ -103,7 +103,7 @@ export class NativeModalRef {
const targetView = new ContentView();
this.portalOutlet = new NativeScriptDomPortalOutlet(targetView, this._config.componentFactoryResolver || this._injector.get(ComponentFactoryResolver), this._injector.get(ApplicationRef), this._injector);
const componentRef = this.portalOutlet.attach(portal);
detectChanges(componentRef.instance);
componentRef.changeDetectorRef.detectChanges();
this.modalViewRef = new NgViewRef(componentRef);
if (this.modalViewRef.firstNativeLikeView !== this.modalViewRef.view) {
(<any>this.modalViewRef.view)._ngDialogRoot = this.modalViewRef.firstNativeLikeView;
Expand Down
4 changes: 2 additions & 2 deletions packages/angular/src/lib/legacy/directives/dialogs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApplicationRef, ComponentFactoryResolver, ComponentRef, Injectable, Injector, NgModuleRef, NgZone, Type, ViewContainerRef, ɵdetectChanges as detectChanges } from '@angular/core';
import { ApplicationRef, ComponentFactoryResolver, ComponentRef, Injectable, Injector, NgModuleRef, NgZone, Type, ViewContainerRef } from '@angular/core';
import { Application, ContentView, Frame, ShowModalOptions, View, ViewBase } from '@nativescript/core';
import { Subject } from 'rxjs';
import { AppHostAsyncView, AppHostView } from '../../app-host-view';
Expand Down Expand Up @@ -169,7 +169,7 @@ export class ModalDialogService {
const portal = new ComponentPortal(options.type);
portalOutlet = new NativeScriptDomPortalOutlet(targetView, options.resolver, this.appRef, childInjector);
const componentRef = portalOutlet.attach(portal);
detectChanges(componentRef.instance);
componentRef.changeDetectorRef.detectChanges();
componentViewRef = new NgViewRef(componentRef);
if (options.useContextAsComponentProps && options.context) {
for (const key in options.context) {
Expand Down