How to use the rax.Children.count function in rax

To help you get started, weโ€™ve selected a few rax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alibaba / rax-map / api / components / polyline / index.js View on Github external
renderEditor(children) {
    if (!children) {
      return null;
    }
    if (Children.count(children) !== 1) {
      return null;
    }
    // const child = Rax.Children.only(children)
    // if (child.type === PolyEditor) {
    //   return React.cloneElement(child, {
    //     __poly__: this.polyline,
    //     __map__: this.map
    //   })
    // }
    return null;
  }
github alibaba / rax-map / api / components / polygon / index.js View on Github external
renderEditor(children) {
    if (!children) {
      return null;
    }
    if (Children.count(children) !== 1) {
      return null;
    }
    // const child = React.Children.only(children)
    // if (child.type === PolyEditor) {
    //   return React.cloneElement(child, {
    //     __poly__: this.polygon,
    //     __map__: this.map
    //   })
    // }
    return null;
  }
github alibaba / rax-map / api / components / circle / index.js View on Github external
renderEditor(children) {
    if (!children) {
      return null;
    }
    if (Children.count(children) !== 1) {
      return null;
    }
    return cloneElement(Children.only(children), {
      __circle__: this.mapCircle,
      __map__: this.map,
      __ele__: this.element
    });
  }
github alibaba / rax / components / rax-console / src / TreeNode.js View on Github external
expanded,
      onClick,
      children,
      nodeRenderer,
      title,
      shouldShowArrow,
      shouldShowPlaceholder,
    } = this.props;

    const renderedNode = createElement(nodeRenderer, this.props);
    const childNodes = expanded ? children : undefined;

    return (
      <div title="{title}" style="{styles.treeNodeBase}" role="treeitem" aria-expanded="{expanded}">
        <div style="{styles.treeNodePreviewContainer}">
          {shouldShowArrow || Children.count(children) &gt; 0
            ? 
            : shouldShowPlaceholder &amp;&amp; <span style="{styles.treeNodePlaceholder}">&nbsp;</span>}
          {renderedNode}
        </div>

        <ol style="{styles.treeNodeChildNodesContainer}" role="group">
          {childNodes}
        </ol>
      </div>
    );
  }
}