reactjs - Element is removed after transitionLeaveTimeout - but how come not inserted after transitionEnterTimeout -
i have issue, animation 1 or 0 items of animation page - http://facebook.github.io/react/docs/animation.html#animating-one-or-zero-items
my component shows message initially. when gets next message, fades out "leaving" element in 1second. because set transitionleavetimeout
1second well, element removed after fade out completes.
however, set transitionentertimeout
1second (and tried 2second), however, "entering" element inserted first child on start of "leaving". how come "entering" element not inserted after transitionentertimeout
? there way make happen?
the reason ask because if both present, "leaving" element gets shifted down line-height. can't css tricks -100% line height , others css bit complex.
here copy paste eample shows issue:
<html> <head> <script src="https://fb.me/react-with-addons-0.14.4.js"></script> <script src="https://fb.me/react-dom-0.14.4.js"></script> <script> var mystore = {}; function init() { var thething = react.createclass({ displayname: 'thething', getinitialstate: function() { return { msg: this.props.msg }; }, componentdidmount: function() { mystore.setstate = this.setstate.bind(this); }, render: function() { return react.createelement(react.addons.csstransitiongroup, {transitionname:'thing', transitionentertimeout:6000, transitionleavetimeout:3000}, react.createelement('div', {key:this.state.msg}, this.state.msg ) ); } }); reactdom.render(react.createelement(thething, {msg:'initial'}), document.getelementbyid('message')); settimeout(function() { mystore.setstate({msg:'hi'}) }, 6000) settimeout(function() { mystore.setstate({msg:'bye'}) }, 12000) } window.addeventlistener('domcontentloaded', init, false); </script> <style> .thing-enter, .thing-appear { opacity: 0; } .thing-enter.thing-enter-active, .thing-appear.thing-appear-active { opacity: 1; transition: opacity 6s ease 3s; } .thing-leave { opacity: 1; } .thing-leave.thing-leave-active { opacity: 0; transition: opacity 3s ease; } </style> </head> <body> <div class="container"> <div id="message"></div> </div> </body> </html>
Comments
Post a Comment