-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Rn accordion #931
Rn accordion #931
Conversation
318dbce
to
e003001
Compare
fbbb7ce
to
624b38f
Compare
这个直接在 patch 里发,没太大影响的; |
Codecov Report
@@ Coverage Diff @@
## master #931 +/- ##
==========================================
+ Coverage 59.08% 59.37% +0.29%
==========================================
Files 215 215
Lines 3876 3916 +40
Branches 1157 1168 +11
==========================================
+ Hits 2290 2325 +35
- Misses 1585 1590 +5
Partials 1 1
Continue to review full report at Codecov.
|
62ff5c0
to
c11dced
Compare
可以的。类似的, changelog 里可以不用写或者写上 “补全 accordion RN 版本” |
components/accordion/index.en-US.md
Outdated
|
||
### Accordion.Panel ( 适用平台:WEB ) | ||
|
||
| 属性 | 说明 | 类型 | 默认值 | | ||
|------------|----------------|----------|-------------| | ||
| key | 对应 activeKey | String | 无 | | ||
| header | 面板头内容 | React.Element or String | 无 | | ||
|
||
`note: RN Accordion 依赖 Icon,使用时需添加对应的 iconfont 字体` |
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.
RN还在用iconfont??
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.
@paranoidjk 恩,rn 没法 svg,直接用字体会比较好
|
||
static Panel: any; | ||
|
||
_renderHeader = (section, _, isActive) => { |
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.
index
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.
这个命名还是别用下划线了,多人的项目不太好。另外这个index没用到的话,eslint应该会报错的吧
const { onChange, children } = this.props; | ||
let key; | ||
React.Children.map(children, (child: any, index) => { | ||
if (idx === index) { |
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.
这里可以注意下之前踩的一个坑: f40d2a4
children用户可能搞 [Panel, Panel, [Panel, Panel, Panel]]
这种情况, 虽然 React.Children.map默认会递归,但还是最好测一下我说的这种情况有没有问题,特别是用到了index来做判断
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.
这个情况,目前支持不了,https://github.com/oblador/react-native-collapsible/blob/master/Collapsible.js#L60 展开的时候就已经计算 height 了,内嵌之后还要通过改变外层的 content 高度,我先在文档注明一下;后面有空了我看看能不能给它提 pr 解决
|
||
class AccordionPanel extends React.Component<AccordionPanelProps, any> { | ||
render() { | ||
return null; |
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.
return null ?
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.
恩,没问题,children 被 renderContent 处理了,其实就是个占位名
e2094bd
to
9ade98e
Compare
No description provided.