I'm trying to solve kind of simple problem: when component is loaded, i need to scroll it to the bottom. But i've wasted ton of hours trying to solve it. I've tried a lot of different ways (scrollIntoView, scrollTop, scrollBy, etc...) but none of them can't do it. Url below is a link to fiddle where i have a simple component and i need Message to be shown. The problem is that i have to scroll about 10 pixels by myself. I would really appreciate if you help me to solve this problem.
class Hello extends React.Component {
componentDidMount() {
const elem = ReactDOM.findDOMNode(this.refs.test);
if (elem) {
elem.scrollIntoView(false);
}
}
render() {
return (
<div>
<div className="test"
ref="test">
Hello {this.props.name}
</div>
<div>Message</div>
</div>
)
}
}
ReactDOM.render(
<Hello name="World" />,
document.getElementById('container')
);