MCPcopy Create free account
hub / github.com/reactjs/react-modal / render

Method render

src/components/ModalPortal.js:373–415  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

371 }, {});
372
373 render() {
374 const {
375 id,
376 className,
377 overlayClassName,
378 defaultStyles,
379 children
380 } = this.props;
381 const contentStyles = className ? {} : defaultStyles.content;
382 const overlayStyles = overlayClassName ? {} : defaultStyles.overlay;
383
384 if (this.shouldBeClosed()) {
385 return null;
386 }
387
388 const overlayProps = {
389 ref: this.setOverlayRef,
390 className: this.buildClassName("overlay", overlayClassName),
391 style: { ...overlayStyles, ...this.props.style.overlay },
392 onClick: this.handleOverlayOnClick,
393 onMouseDown: this.handleOverlayOnMouseDown
394 };
395
396 const contentProps = {
397 id,
398 ref: this.setContentRef,
399 style: { ...contentStyles, ...this.props.style.content },
400 className: this.buildClassName("content", className),
401 tabIndex: "-1",
402 onKeyDown: this.handleKeyDown,
403 onMouseDown: this.handleContentOnMouseDown,
404 onMouseUp: this.handleContentOnMouseUp,
405 onClick: this.handleContentOnClick,
406 role: this.props.role,
407 "aria-label": this.props.contentLabel,
408 ...this.attributesFromObject("aria", { modal: true, ...this.props.aria }),
409 ...this.attributesFromObject("data", this.props.data || {}),
410 "data-testid": this.props.testId
411 };
412
413 const contentElement = this.props.contentElement(contentProps, children);
414 return this.props.overlayElement(overlayProps, contentElement);
415 }
416}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected