/** * @fileOverview Customized */ import * as React from 'react'; import { isValidElement, cloneElement, createElement, Component, FunctionComponent, ReactElement } from 'react'; import { Layer } from '../container/Layer'; import { warn } from '../util/LogUtils'; type Comp

= FunctionComponent

| Component

| ReactElement

; export type Props> = P & { component: C; }; /** * custom svg elements by rechart instance props and state. * @returns {Object} svg elements */ export function Customized>({ component, ...props }: Props) { let child; if (isValidElement(component)) { child = cloneElement(component, props); } else if (typeof component === 'function') { child = createElement(component, props as any); } else { warn(false, "Customized's props `component` must be React.element or Function, but got %s.", typeof component); } return {child}; } Customized.displayName = 'Customized';