mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-06-29 09:23:27 +03:00
Scroll to bottom while hidden
This commit is contained in:
parent
e03e66c680
commit
31baa586b8
|
@ -28,8 +28,13 @@ export default class LogMonitor {
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (this.props.stagedActions.length < nextProps.stagedActions.length) {
|
const node = findDOMNode(this);
|
||||||
const scrollableNode = findDOMNode(this).parentElement;
|
if (!node) {
|
||||||
|
this.scrollDown = true;
|
||||||
|
} else if (
|
||||||
|
this.props.stagedActions.length < nextProps.stagedActions.length
|
||||||
|
) {
|
||||||
|
const scrollableNode = node.parentElement;
|
||||||
const { scrollTop, offsetHeight, scrollHeight } = scrollableNode;
|
const { scrollTop, offsetHeight, scrollHeight } = scrollableNode;
|
||||||
|
|
||||||
this.scrollDown = Math.abs(
|
this.scrollDown = Math.abs(
|
||||||
|
@ -40,12 +45,14 @@ export default class LogMonitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate() {
|
||||||
if (
|
const node = findDOMNode(this);
|
||||||
prevProps.stagedActions.length < this.props.stagedActions.length &&
|
if (!node) {
|
||||||
this.scrollDown
|
return;
|
||||||
) {
|
}
|
||||||
const scrollableNode = findDOMNode(this).parentElement;
|
|
||||||
|
if (this.scrollDown) {
|
||||||
|
const scrollableNode = node.parentElement;
|
||||||
const { offsetHeight, scrollHeight } = scrollableNode;
|
const { offsetHeight, scrollHeight } = scrollableNode;
|
||||||
|
|
||||||
scrollableNode.scrollTop = scrollHeight - offsetHeight;
|
scrollableNode.scrollTop = scrollHeight - offsetHeight;
|
||||||
|
@ -88,7 +95,11 @@ export default class LogMonitor {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const elements = [];
|
const elements = [];
|
||||||
const { skippedActions, stagedActions, computedStates, select } = this.props;
|
const { monitorState, skippedActions, stagedActions, computedStates, select } = this.props;
|
||||||
|
|
||||||
|
if (!monitorState.isVisible) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < stagedActions.length; i++) {
|
for (let i = 0; i < stagedActions.length; i++) {
|
||||||
const action = stagedActions[i];
|
const action = stagedActions[i];
|
||||||
|
@ -106,7 +117,6 @@ export default class LogMonitor {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.monitorState.isVisible === true) {
|
|
||||||
return (
|
return (
|
||||||
<div style={{
|
<div style={{
|
||||||
fontFamily: 'monospace',
|
fontFamily: 'monospace',
|
||||||
|
@ -158,7 +168,4 @@ export default class LogMonitor {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user