How to use the omi.createElement function in omi

To help you get started, we’ve selected a few omi 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 Tencent / omi / packages / omiu / src / rc-tree / tree-node.js View on Github external
// Icon - Still show loading icon when loading without showIcon
    let $icon;

    if (showIcon) {
      const currentIcon = icon || treeIcon;

      $icon = currentIcon ? (
        <span
          className={classNames(
            `${prefixCls}-iconEle`,
            `${prefixCls}-icon__customize`,
          )}
        >
          {typeof currentIcon === 'function' ?
            omi.createElement(currentIcon, {
              ...this.props,
            }) : currentIcon}
        </span>
      ) : this.renderIcon();
    } else if (loadData && loading) {
      $icon = this.renderIcon();
    }

    // Title
    const $title = <span className={`${prefixCls}-title`}>{title}</span>;

    return (
      <span
        ref={this.setSelectHandle}
        title={typeof title === 'string' ? title : ''}
        className={classNames(
github Tencent / omi / packages / omiu / src / rc-tree / tree-node.js View on Github external
switcherIcon: switcherIconFromProps,
    } = this.props;
    const {
      omiTree: {
        prefixCls,
        switcherIcon: switcherIconFromCtx,
      }
    } = this.store;

    const switcherIcon = switcherIconFromProps || switcherIconFromCtx;

    if (this.isLeaf()) {
      return (
        <span className={classNames(`${prefixCls}-switcher`, `${prefixCls}-switcher-noop`)}>
          {typeof switcherIcon === 'function' ?
            omi.createElement(switcherIcon, { ...this.props, isLeaf: true }) : switcherIcon}
        </span>
      );
    }

    const switcherCls = classNames(`${prefixCls}-switcher`, `${prefixCls}-switcher_${expanded ? ICON_OPEN : ICON_CLOSE}`);
    return (
      <span onClick={this.onExpand} className={switcherCls}>
        {typeof switcherIcon === 'function' ?
          omi.createElement(switcherIcon, { ...this.props, isLeaf: false }) : switcherIcon}
      </span>
    );
	}