Conversation
|
Changes Unknown when pulling fb52de7 on preact-compat into ** on master**. |
|
Changes Unknown when pulling 32e3224 on preact-compat into ** on master**. |
|
ref #77 一并修复下算了 😄 |
|
done. 那个pr是外国友人提交的? |
|
Changes Unknown when pulling 6b08174 on preact-compat into ** on master**. |
| } | ||
| const key = child.key; | ||
| let cls = activeKey === key ? `${prefixCls}-tab-active` : ''; | ||
| let cls = this.props.activeKey === key ? `${prefixCls}-tab-active` : ''; |
There was a problem hiding this comment.
事实是有区别的,搞了我一天,fml
There was a problem hiding this comment.
不过这行代码可能没影响,但这个方法体内要改就全改了。
| const containerOffset = offset(wrapNode); | ||
| const inkBarNode = refs.inkBar; | ||
| const activeTab = refs.activeTab; | ||
| const activeTab = component.activeTab; |
There was a problem hiding this comment.
这个改动,rc-tabs 肯定是要升 major 的
不确定是不是有依赖 refs.activeTab
|
close #77 see https://help.github.com/articles/closing-issues-via-commit-messages/ |
| key={key} | ||
| {...refProps} | ||
| ref={(tab) => { | ||
| if (this.props.activeKey === key) { |
There was a problem hiding this comment.
关键的一点:外层定义的const activeKey = props.activeKey;在ref的callback执行的时候,不是预期中的值,已经变掉了。
There was a problem hiding this comment.
直接取this.props.activeKey 就符合预期了
There was a problem hiding this comment.
这怎么可能? 你的意思是用户把 activeKey 改变了?callback 执行的时候拿到的是旧的值?
There was a problem hiding this comment.
运行demo, 把react 依赖换成preact配套的依赖,就可以重现了
|
@pingan1927 rebase master, 我加了个 |
|
@pingan1927 rebase master, i fixed #77 |
ad05438 to
9f17593
Compare
|
@paranoidjk done, test应该都是通过了的 |
paranoidjk
left a comment
There was a problem hiding this comment.
@pingan1927 测试要仔细一点。用真机测,在 preact 上,滑动 tab 内容切换 tab 失效了,切换回 react 没问题。
|
哦?这两天忙完了 继续看看 |
|
@pingan1927 这个拖太久了,再不处理我就过期关掉了? |
|
这个我来处理算了。 |
9f17593 to
965368f
Compare
9423f17 to
0ea9baf
Compare
0ea9baf to
e747eab
Compare
|
close. @zhang740 在重写 rmc-tabs. @zhang740 开发过程中可以用我 fork 的 rmc-tools https://github.com/paranoidjk/rc-tools#preact 测试下 preact 运行是否ok。 |
lint & test done.
原来写法preact会有问题,activeKey获取的不是最新值。
改了ref的写法,看看是否需要发大版本。