diff --git a/packages/react-simulator-renderer/src/renderer-view.tsx b/packages/react-simulator-renderer/src/renderer-view.tsx index 7b41312c8..e964c2be9 100644 --- a/packages/react-simulator-renderer/src/renderer-view.tsx +++ b/packages/react-simulator-renderer/src/renderer-view.tsx @@ -7,7 +7,7 @@ import './renderer.less'; // patch cloneElement avoid lost keyProps const originCloneElement = window.React.cloneElement; -(window as any).React.cloneElement = (child: any, { _leaf, ...props}: any = {}) => { +(window as any).React.cloneElement = (child: any, { _leaf, ...props }: any = {}) => { if (child.ref && props.ref) { const dRef = props.ref; const cRef = child.ref; @@ -18,7 +18,7 @@ const originCloneElement = window.React.cloneElement; } else { try { cRef.current = x; - } catch (e) { } + } catch (e) {} } } if (dRef) { @@ -27,13 +27,13 @@ const originCloneElement = window.React.cloneElement; } else { try { dRef.current = x; - } catch (e) { } + } catch (e) {} } } - } - }; + }; + } return originCloneElement(child, props); -} +}; export default class SimulatorRendererView extends Component<{ renderer: SimulatorRenderer }> { render() { @@ -87,7 +87,7 @@ class Renderer extends Component<{ renderer: SimulatorRenderer }> { return createElement( Component, viewProps, - children == null ? null : Array.isArray(children) ? children : [children], + children == null ? [] : Array.isArray(children) ? children : [children], ); }} onCompGetRef={(schema: any, ref: ReactInstance | null) => {