fix: backTop target (#3399)

fix: BackTop target
This commit is contained in:
Wei Zhu 2016-10-14 15:26:22 +08:00 committed by Benjy Cui
parent 10afe1372f
commit 6c0c495177

View File

@ -47,9 +47,8 @@ export default class BackTop extends React.Component<BackTopProps, any> {
constructor(props) {
super(props);
const scrollTop = getScroll(props.target(), true);
this.state = {
visible: scrollTop > props.visibilityHeight,
visible: false,
};
}
@ -87,6 +86,7 @@ export default class BackTop extends React.Component<BackTopProps, any> {
}
componentDidMount() {
this.handleScroll();
this.scrollEvent = addEventListener(this.props.target(), 'scroll', this.handleScroll);
}