[英]How to slide down a stateless component in React JS using ReactCSStransitionGroup or ReactTransitionGroup?
I want to slide a stateless component, which will be initially set to display:none
, to be visible after state change in one of its parent component, as if it is slide down just like a dropdown. 我想滑动一个无状态组件,该组件最初将设置为
display:none
,以便在其父组件之一的状态更改后可见,就像它像下拉菜单一样向下滑动。 I am new to animation part, I was trying out this_link . 我是动画部分的新手,我正在尝试this_link 。
So far what i tried in Sandbox ( https://codesandbox.io/s/0xrjp051pp ). 到目前为止,我在沙盒( https://codesandbox.io/s/0xrjp051pp )中尝试过的工作。
Can someone help on this? 有人可以帮忙吗?
Here is the modified Sandbox with the transition working. 这是带有过渡功能的修改后的沙盒。 https://codesandbox.io/s/nrz8vlmrrl The only thing that you need to fix is the CSS code to get it to work a desired.
https://codesandbox.io/s/nrz8vlmrrl唯一需要修复的是CSS代码,以使其正常工作。
The changes I made are as follows. 我所做的更改如下。
SubComponent
. SubComponent
使用的道具来显示和隐藏组件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.