Skip to content

Commit

Permalink
fix: #1262
Browse files Browse the repository at this point in the history
  • Loading branch information
wugaoliang committed Nov 2, 2020
1 parent 42cd491 commit 8f5bc9d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions components/tag/TagItem.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, forwardRef } from 'react'
import classNames from 'classnames'
import './style'
import Icon from '../icon'
import { CSSTransition } from 'react-transition-group'

const noop = () => {}
const TagItem = ({
const InternalTagItem = ({
type = 'primary',
appearance = 'default',
onClick,
Expand All @@ -21,7 +21,8 @@ const TagItem = ({
onMouseEnter = noop,
onMouseLeave = noop,
hoverIndex = -1,
shape = 'round'
shape = 'round',
innerRef
}) => {
const [vi, setVi] = useState(false)
useEffect(() => {
Expand Down Expand Up @@ -49,6 +50,7 @@ const TagItem = ({
'hi-tag--line': appearance === 'line',
'hi-tag--square': shape === 'square'
})}
ref={innerRef}
onClick={onClick}
style={{ ...style, ...tagStyle }}
onDoubleClick={() => {
Expand Down Expand Up @@ -77,4 +79,7 @@ const TagItem = ({
)
}

const TagItem = forwardRef((props, ref) => {
return <InternalTagItem {...props} innerRef={ref} />
})
export default TagItem

0 comments on commit 8f5bc9d

Please sign in to comment.