From f472a73bf3ab56b4e6621a3b31fa09139e69b384 Mon Sep 17 00:00:00 2001 From: zombiej Date: Mon, 2 Dec 2019 11:42:13 +0800 Subject: [PATCH] bump 3.0.0 to fix react lifecycle warning --- package.json | 4 ++-- src/index.js | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 30219b79..47a1f20c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-trigger", - "version": "3.0.0-rc.3", + "version": "3.0.0", "description": "base abstract trigger component for react", "keywords": [ "react", @@ -62,6 +62,6 @@ "raf": "^3.4.0", "rc-align": "^2.4.1", "rc-animate": "^3.0.0-rc.1", - "rc-util": "^4.4.0" + "rc-util": "^4.15.7" } } diff --git a/src/index.js b/src/index.js index 0b20643b..a17f59a3 100644 --- a/src/index.js +++ b/src/index.js @@ -8,6 +8,7 @@ import { getAlignFromPlacement, getAlignPopupClassName } from './utils'; import ContainerRender from 'rc-util/lib/ContainerRender'; import Portal from 'rc-util/lib/Portal'; import classNames from 'classnames'; +import unsafeLifecyclesPolyfill from 'rc-util/lib/unsafeLifecyclesPolyfill'; function noop() { } @@ -25,7 +26,7 @@ const ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', const IS_REACT_16 = !!createPortal; -export default class Trigger extends React.Component { +class Trigger extends React.Component { static propTypes = { children: PropTypes.any, action: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]), @@ -111,9 +112,7 @@ export default class Trigger extends React.Component { this.state = { popupVisible, }; - } - componentWillMount() { ALL_HANDLERS.forEach((h) => { this[`fire${h}`] = (e) => { this.fireEvents(h, e); @@ -636,3 +635,5 @@ export default class Trigger extends React.Component { ]; } } + +export default unsafeLifecyclesPolyfill(Trigger);