ngAfterViewInit()

in libs/core/src/lib/components/wrapper-component.ts [131:148]


  ngAfterViewInit() {
    if (this._shouldSetHostDisplay) {
      this._setHostDisplay();
    }

    // NOTE: Workaround/fix for Issue #5 (https://github.com/Microsoft/angular-react/issues/5).
    // The wrapper component isn't added to the root react nodes list when it's inside a `ReactContent` node, we manually add it (note that the root nodes list is a `Set`, so it won't duplicate nodes if already exist).
    // There's potentially a better solution instead of this
    const rendererData = this.renderer.data;
    if (isReactRendererData(rendererData)) {
      afterRenderFinished(() => {
        const nativeElement = this.reactNodeRef.nativeElement;
        if (isReactNode(nativeElement)) {
          rendererData.addRootNode(nativeElement);
        }
      });
    }
  }