in libs/core/src/lib/renderer/components/Disguise.ts [64:90]
private _renderReactContentChildren() {
const { ngChildComponents, disguiseChildrenAs } = this.props;
const renderedChildren = ngChildComponents.map((child, index) => {
const propsToPass = removeUndefinedProperties(
getPassProps(child).reduce(
(acc, passProp) => Object.assign(acc, { [passProp.targetKey]: child[passProp.sourceKey] }),
{}
)
);
return React.createElement(disguiseChildrenAs, {
...propsToPass,
key: index,
ref: childReactElement => {
// ref callback is called with null when the component unmounts from the DOM, we don't need to handle it.
if (!childReactElement) {
return;
}
ReactDOM.findDOMNode(childReactElement).appendChild(child.elementRef.nativeElement);
},
});
});
return renderedChildren;
}