fix: remove scrolling (#37098)

This commit is contained in:
Ahmad Abdolsaheb
2019-10-08 12:00:08 +03:00
committed by mrugesh
parent 6103991d8b
commit 6ed3426128
3 changed files with 0 additions and 27 deletions

View File

@ -16956,15 +16956,6 @@
}
}
},
"react-scroll": {
"version": "1.7.14",
"resolved": "https://registry.npmjs.org/react-scroll/-/react-scroll-1.7.14.tgz",
"integrity": "sha512-zQ2/8+TaEBctA9RSQspP5GWMffA6g7u+AB9gMWB42btZZTBcGEyomvxnm52UVVELjqXOpD9U1/tHhVTNXyntbQ==",
"requires": {
"lodash.throttle": "^4.1.1",
"prop-types": "^15.5.8"
}
},
"react-side-effect": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-1.1.5.tgz",

View File

@ -60,7 +60,6 @@
"react-redux": "^5.0.7",
"react-reflex": "^3.0.16",
"react-responsive": "^6.1.1",
"react-scroll": "^1.7.14",
"react-spinkit": "^3.0.0",
"react-stripe-elements": "^2.0.3",
"react-tooltip": "^3.10.0",

View File

@ -5,7 +5,6 @@ import { bindActionCreators } from 'redux';
import PropTypes from 'prop-types';
import uniq from 'lodash/uniq';
import { createSelector } from 'reselect';
import { scroller } from 'react-scroll';
import SuperBlock from './components/SuperBlock';
import Spacer from '../helpers/Spacer';
@ -57,21 +56,9 @@ function mapDispatchToProps(dispatch) {
export class Map extends Component {
constructor(props) {
super(props);
this.state = { idToScrollto: null };
this.initializeExpandedState();
}
componentDidMount() {
if (this.state.idToScrollto) {
window.scrollTo(0, 0);
scroller.scrollTo(this.state.idToScrollto, {
duration: 1500,
smooth: 'easeInOutQuint',
offset: -35
});
}
}
// As this happens in the constructor, it's necessary to manipulate state
// directly.
initializeExpandedState() {
@ -89,16 +76,12 @@ export class Map extends Component {
// find the challenge that has the same superblock with hash
if (hash) {
node = nodes.find(node => dasherize(node.superBlock) === hash);
// eslint-disable-next-line react/no-direct-mutation-state
if (node) this.state = { idToScrollto: dasherize(node.superBlock) };
}
// if there is no hash or the hash did not match any challenge superblock
// and there was a currentChallengeId
if (!node && currentChallengeId) {
node = nodes.find(node => node.id === currentChallengeId);
// eslint-disable-next-line react/no-direct-mutation-state
if (node) this.state = { idToScrollto: dasherize(node.title) };
}
if (!node) node = nodes[0];