From 7408fec143fb5b644549ff58baac85e9b97c13e7 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Wed, 21 Aug 2019 11:21:46 -0700 Subject: [PATCH] scroll jump on preset application is fixed --- components/Settings.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/components/Settings.js b/components/Settings.js index 5bac917..6b015ce 100644 --- a/components/Settings.js +++ b/components/Settings.js @@ -234,8 +234,6 @@ class Settings extends React.PureComponent { settingsRef = React.createRef() - presetContentRef = React.createRef() - componentDidMount() { const storedPresets = getPresets(localStorage) || [] this.setState(({ presets }) => ({ @@ -279,11 +277,7 @@ class Settings extends React.PureComponent { this.props.applyPreset(preset) - // TODO: this is a hack to prevent the scrollLeft position from changing when preset is applied - const { scrollLeft: previousScrollLeft } = this.presetContentRef.current - this.setState({ previousSettings }, () => { - this.presetContentRef.current.scrollLeft = previousScrollLeft - }) + this.setState({ previousSettings }) } undoPreset = () => { @@ -412,7 +406,6 @@ class Settings extends React.PureComponent { remove={this.removePreset} create={this.createPreset} applied={!!previousSettings} - contentRef={this.presetContentRef} />