scroll jump on preset application is fixed

main
Mike Fix 5 years ago
parent 9032c70dd8
commit 7408fec143

@ -234,8 +234,6 @@ class Settings extends React.PureComponent {
settingsRef = React.createRef() settingsRef = React.createRef()
presetContentRef = React.createRef()
componentDidMount() { componentDidMount() {
const storedPresets = getPresets(localStorage) || [] const storedPresets = getPresets(localStorage) || []
this.setState(({ presets }) => ({ this.setState(({ presets }) => ({
@ -279,11 +277,7 @@ class Settings extends React.PureComponent {
this.props.applyPreset(preset) this.props.applyPreset(preset)
// TODO: this is a hack to prevent the scrollLeft position from changing when preset is applied this.setState({ previousSettings })
const { scrollLeft: previousScrollLeft } = this.presetContentRef.current
this.setState({ previousSettings }, () => {
this.presetContentRef.current.scrollLeft = previousScrollLeft
})
} }
undoPreset = () => { undoPreset = () => {
@ -412,7 +406,6 @@ class Settings extends React.PureComponent {
remove={this.removePreset} remove={this.removePreset}
create={this.createPreset} create={this.createPreset}
applied={!!previousSettings} applied={!!previousSettings}
contentRef={this.presetContentRef}
/> />
<div className="settings-bottom"> <div className="settings-bottom">
<div className="settings-menu"> <div className="settings-menu">

Loading…
Cancel
Save