Skip to content

Commit

Permalink
fix(overlay): set position when content or context update (#2081)
Browse files Browse the repository at this point in the history
  • Loading branch information
FourthOf5 authored and yggg committed Nov 25, 2019
1 parent 9ec661a commit e85830f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class NbDynamicOverlay {
protected content: NbOverlayContent;
protected positionStrategy: NbAdjustableConnectedPositionStrategy;
protected overlayConfig: NbOverlayConfig = {};
protected lastAppliedPosition: NbPosition;

protected positionStrategyChange$ = new Subject();
protected isShown$ = new BehaviorSubject<boolean>(false);
Expand Down Expand Up @@ -108,7 +109,10 @@ export class NbDynamicOverlay {
takeUntil(this.positionStrategyChange$),
filter(() => !!this.container),
)
.subscribe((position: NbPosition) => patch(this.container, { position }));
.subscribe((position: NbPosition) => {
this.lastAppliedPosition = position;
patch(this.container, { position });
});

if (this.ref) {
this.ref.updatePositionStrategy(this.positionStrategy);
Expand Down Expand Up @@ -201,6 +205,7 @@ export class NbDynamicOverlay {
content: this.content,
context: this.context,
cfr: this.componentFactoryResolver,
position: this.lastAppliedPosition,
};
}

Expand Down

0 comments on commit e85830f

Please sign in to comment.