How to use the rax.cloneElement 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 / map / index.js View on Github external
return Children.map(this.props.children, (child) => {
      if (child) {
        const cType = child.type;
        /* 针对下面两种组件不注入地图相关属性
         * 1. 明确声明不需要注入的
         * 2. DOM 元素
         */
        if (cType.preventAmap || (typeof cType === 'string')) {
          return child;
        }
        return cloneElement(child, {
          __map__: this.map,
          __raxMap__: this
        });
      }
      return child;
    });
  }
github alibaba / rax / packages / rax-slider / src / slider.web.js View on Github external
styles.normalDot,
      {
        backgroundColor: itemColor,
        width: itemSize,
        height: itemSize
      }
    ];

    let dots = [];
    const ActiveDot = this.props.activeDot ||
github alibaba / rax / packages / template-taobao / templates / default / mods / SliderForWeb.js View on Github external
{
        backgroundColor: itemColor,
        width: itemSize,
        height: itemSize
      }
    ];

    let dots = [];
    const ActiveDot = this.props.activeDot ||
github alibaba / rax / packages / rax-tabbar / src / TabBar.js View on Github external
let tabs = this.getTabs().map((tab, index) => {
      if (tab.props.children) {
        tabContents.push(createElement(TabBarContents, {
          key: index,
          index: index,
          selected: this.state.selectedIndex === index,
        }, tab.props.children));
        ++ tabContentsCount;
      } else {
        tabContents.push(undefined);
      }

      return cloneElement(tab, {
        index: index,
        ref: `tab_${index}`,
        selected: this.state.selectedIndex === index,
        selectedIcon: tab.props.selectedIcon,
        handleTouchTap: this.handleTouchTap,
        inHorizontal: this.props.horizontal || false
      });
    });
github alibaba / rax / packages / rax-slider / src / slider.web.js View on Github external
{
        backgroundColor: itemColor,
        width: itemSize,
        height: itemSize
      }
    ];

    let dots = [];
    const ActiveDot = this.props.activeDot ||
github alibaba / rax / packages / template-taobao / templates / default / mods / SliderForWeb.js View on Github external
styles.normalDot,
      {
        backgroundColor: itemColor,
        width: itemSize,
        height: itemSize
      }
    ];

    let dots = [];
    const ActiveDot = this.props.activeDot ||
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 / packages / rax-waterfall / src / index.js View on Github external
cells = cells.concat(footer.map((child, index) => {
      if (child) {
        if (child.type != Header) {
          return <header>{child}</header>;
        } else {
          return cloneElement(child, {});
        }
      }
    }));