Skip to content

Commit d55422a

Browse files
committed
Use state.initialStyle for node opacity transitions
1 parent 90da59c commit d55422a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Node/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export default class Node extends React.Component {
1414

1515
this.state = {
1616
transform: this.setTransformOrientation(originX, originY),
17+
initialStyle: {
18+
opacity: 0,
19+
},
1720
};
1821

1922
this.handleClick = this.handleClick.bind(this);
@@ -73,6 +76,7 @@ export default class Node extends React.Component {
7376
render() {
7477
const { nodeData, transitionDuration } = this.props;
7578

79+
// FIXME unstable when transitionDuration undefined
7680
const transform = transitionDuration && transitionDuration > 0 ?
7781
this.state.transform :
7882
this.setTransformOrientation(nodeData.x, nodeData.y);
@@ -81,6 +85,7 @@ export default class Node extends React.Component {
8185
<g
8286
id={nodeData.id}
8387
ref={(n) => { this.node = n; }}
88+
style={this.state.initialStyle}
8489
className={nodeData._children ? 'nodeBase' : 'leafNodeBase'}
8590
transform={transform}
8691
onClick={this.handleClick}

0 commit comments

Comments
 (0)