From db7612573cf9eb1003659a422b9db112787318b7 Mon Sep 17 00:00:00 2001 From: Smit Patel Date: Fri, 5 May 2023 16:18:31 +0000 Subject: [PATCH] fix: scroll issue after scrolling and selecting elements --- src/Options.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Options.js b/src/Options.js index c6ed9a7..92d12e0 100644 --- a/src/Options.js +++ b/src/Options.js @@ -1,13 +1,9 @@ -import React, { Component } from 'react'; +import React, { PureComponent } from 'react'; import cx from 'classnames'; import Option from './Option'; import { getOptionIndex, isOptGroup } from './utils'; -export default class Options extends Component { - componentWillReceiveProps({ options, highlightedOption }) { - this.scrollTo({ options, highlightedOption }); - } - +export default class Options extends PureComponent { componentDidMount() { let { options, highlightedOption } = this.props; this.optionsListOffsetHeight = this.optionsList.offsetHeight;