Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
chore: Avoid render icon if renderFunc return null
  • Loading branch information
zombieJ committed Sep 2, 2019
1 parent a15383c commit 5e3ecd0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/TransBtn.tsx
@@ -1,9 +1,10 @@
import * as React from 'react';
import classNames from 'classnames';
import { RenderNode } from './interface';

export interface TransBtnProps {
className: string;
customizeIcon: React.ReactNode;
customizeIcon: RenderNode;
customizeIconProps?: { isSelected: boolean };
onMouseDown?: React.MouseEventHandler<HTMLSpanElement>;
onClick?: React.MouseEventHandler<HTMLSpanElement>;
Expand Down Expand Up @@ -43,7 +44,9 @@ const TransBtn: React.FC<TransBtnProps> = ({
onClick={onClick}
aria-hidden
>
{icon || (
{icon !== undefined ? (
icon
) : (
<span className={classNames(className.split(/\s+/).map(cls => `${cls}-icon`))}>
{children}
</span>
Expand Down

1 comment on commit 5e3ecd0

@vercel
Copy link

@vercel vercel bot commented on 5e3ecd0 Sep 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.