Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// so user can have access to the react container,
// to add css class or style
params.reactContainer = this.eParentElement;
let self = this;
const ReactComponent = React.createElement(this.reactComponent, params);
if (!this.parentComponent) {
// MUST be a function, not an arrow function
ReactDOM.render(ReactComponent, this.eParentElement, function () {
self.componentRef = this;
});
} else {
// MUST be a function, not an arrow function
ReactDOM.unstable_renderSubtreeIntoContainer(this.parentComponent, ReactComponent, this.eParentElement, function () {
self.componentRef = this;
});
}
}
return (item: any, element: Element, changedData?: any) => {
if (!changedData) { return; }
const markup = renderData(item);
ReactDOM.unstable_renderSubtreeIntoContainer(parent, markup, element);
// Cast return type to any as
// there is incomplete function type definition of TimelineOptionsTemplateFunction,
// the documentation states that the function can return string or ReactDOM.render() result.
//
// In React 16.x rendering using ReactDOM always returns null inside lifecycle methods,
// however if we return a non-Element object, Vis.js will call template function again
// without `changedData` specified.
return {} as any;
};
}
renderIntoSubtree() {
ReactDOM.unstable_renderSubtreeIntoContainer(
this,
this.renderChildren(),
this._element // eslint-disable-line no-underscore-dangle
);
// check if modal should receive focus
if (this._focus) { // eslint-disable-line no-underscore-dangle
this._dialog.parentNode.focus(); // eslint-disable-line no-underscore-dangle
this._focus = false; // eslint-disable-line no-underscore-dangle
}
}
_refreshPortalContent() {
const {children} = this.props;
if (!this._destination || !children) {
return;
}
// Now we can render the portal content.
// We have to render the subtree like this so that everything works as
// expected.
// See https://github.com/tajo/react-portal/blob/master/src/LegacyPortal.js
ReactDOM.unstable_renderSubtreeIntoContainer(
this,
children,
this._destination,
);
}
private renderPortal() {
ReactDOM.unstable_renderSubtreeIntoContainer(this, this.portalContent, this.getContainer());
}
renderPortal(props) {
this.subtree = ReactDom.unstable_renderSubtreeIntoContainer(
this, props.children, this.node,
);
}
_renderChild() {
ReactDOM.unstable_renderSubtreeIntoContainer(
this,
{this.props.children}
,
this._domContainer
);
}
}
function renderComponent(instance) {
if (instance.props.visible) {
if (!instance.container) {
instance.container = instance.getContainer();
}
ReactDOM.unstable_renderSubtreeIntoContainer(instance,
, instance.container);
}
}