-
Notifications
You must be signed in to change notification settings - Fork 106
Add CSSMotion
component
#41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
"lint" | ||
], | ||
"dependencies": { | ||
"babel-runtime": "6.x", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是在这里的。
tests/index.js
Outdated
@@ -1,7 +1,9 @@ | |||
import 'core-js/es6/map'; | |||
import 'core-js/es6/set'; | |||
import 'core-js/es6/promise'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要 promise 要说明下。
const statusStyle = styleFunc ? styleFunc(ReactDOM.findDOMNode(this), event) : null; | ||
|
||
if (statusStyle === false) return; | ||
if (statusStyle === false || this._destroyed) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这种方式不好,更彻底的解决方式是在 ummount 之后把没触发的 raf 都 cancel 掉。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个看起来还得留着,用户如果在 onMotionEnd 的时候父组件 setState 把这个子组件删了。React 会同步执行,这个时候运行到下面的 setState 就报 warning 了。
要改名的节凑???还有这回调有点多。。。会晕。。。。 |
加了个新的组件,旧的准备慢慢慢慢慢慢慢慢慢慢慢慢慢慢慢慢慢慢慢慢慢慢慢慢废弃掉~ 其实就是 Transition 可以加自定义 style |
赞!!!我很早就想整一个用 transition 来完成动画的组件,,但这写法感觉为什么跟 react-motion 差不多,,有点多。。为什么不直接把 show 写在下面,,跟 queue-anim 和原来的写法保持一致呢,,不然我 scroll-anim 里要加一种形式了。。。 <CSSMotion
motionName="transition"
>
{show && <div key="1">test</div>}
</CSSMotion> 还有 static isCSSMotion = true; 加一个。。。 |
render props 非常适合动画场景于是就天下大同了, |
我还是觉得那样写方便。。。如果这是最基本的组件,,是不是可以考虑直接 |
当时为什么要写动效组件,,也就是这原因,,看 react-motion 逻辑太薄,写起来太麻烦,才选择自已写动画组件的。。。 |
这个看需求吧,目前为止 CSSMotion 可以覆盖 rc 和 antd 要用到的场景了。需求强烈就搞个 CSSMotionGroup 管理 group animation。 |
额,,没懂我的意思??不是 group 的问题,,好吧,,随便你整吧。。反正这个组件是在组件里使用的。其实你这种写法我为什么不直接用 react-transition-group 和 react-motion。为毛要重写个??有啥意义??? |
嗯?你可以再说说是什么。 CSSMotion 的主要目的是给 transition 的每个状态都提供一个接口,在 transition 每个状态切换时都有一帧用于让用户可以根据当前实际 dom 来设置 style。参考的就是 react-transition-group CSSTransition,只是多了个返回 style 的功能。 |
CSSMotion
component to support mix className & style in react management by render propsref discuss: #40