diff --git a/packages/ui-toolkit/package.json b/packages/ui-toolkit/package.json index d5c912f7..4a0cdd0c 100644 --- a/packages/ui-toolkit/package.json +++ b/packages/ui-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@groww-tech/ui-toolkit", - "version": "0.5.4", + "version": "0.5.5", "description": "A lightning nature UI", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", diff --git a/packages/ui-toolkit/src/components/atoms/Dropdown/Dropdown.tsx b/packages/ui-toolkit/src/components/atoms/Dropdown/Dropdown.tsx index 3b5f588b..c8c6eadc 100644 --- a/packages/ui-toolkit/src/components/atoms/Dropdown/Dropdown.tsx +++ b/packages/ui-toolkit/src/components/atoms/Dropdown/Dropdown.tsx @@ -29,7 +29,7 @@ class Dropdown extends React.PureComponent { componentWillUnmount() { document.removeEventListener('click', this._onWindowClick); document.removeEventListener('touchstart', this._onWindowClick); - document.removeEventListener('keyup', this._onKeyDownHandler); + document.removeEventListener('keydown', this._onKeyDownHandler); } diff --git a/packages/ui-toolkit/src/components/atoms/Select/Select.tsx b/packages/ui-toolkit/src/components/atoms/Select/Select.tsx index db6a4cbc..9b84b214 100644 --- a/packages/ui-toolkit/src/components/atoms/Select/Select.tsx +++ b/packages/ui-toolkit/src/components/atoms/Select/Select.tsx @@ -39,6 +39,13 @@ class Select extends React.PureComponent { } + componentWillUnmount() { + this.optionsRefArr.forEach((ref: any) => (ref.current = null)); + this.optionsRefArr = []; + this.selectDropdownRef = null; + } + + render() { const { data: options } = this.props;