From 9b28e46d4c3187e442d57293fdb271cedc2f85e2 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 20 Aug 2015 13:56:08 +0800 Subject: [PATCH] still use Magic offsetWidth set --- components/tag/index.jsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/components/tag/index.jsx b/components/tag/index.jsx index c037f637a5..70972fcb2e 100644 --- a/components/tag/index.jsx +++ b/components/tag/index.jsx @@ -14,6 +14,9 @@ class AntTag extends React.Component { close(e) { let dom = React.findDOMNode(this); + dom.style.width = dom.offsetWidth + 'px'; + // It's Magic Code, don't know why + dom.style.width = dom.offsetWidth + 'px'; this.setState({ closing: true }); @@ -26,11 +29,6 @@ class AntTag extends React.Component { this.props.onClose.call(this, e); } - componentDidMount() { - let dom = React.findDOMNode(this); - dom.style.width = (dom.getBoundingClientRect().width || dom.offsetWidth) + 'px'; - } - render() { let close = this.props.closable ? : '';