Skip to content
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

Merged
merged 1 commit into from
Mar 10, 2017
Merged

Rn accordion #931

merged 1 commit into from
Mar 10, 2017

Conversation

silentcloud
Copy link
Contributor

No description provided.

@paranoidjk paranoidjk force-pushed the master branch 2 times, most recently from 318dbce to e003001 Compare March 9, 2017 16:05
@silentcloud silentcloud changed the title [WIP] Rn accordion Rn accordion Mar 10, 2017
@silentcloud
Copy link
Contributor Author

这个直接在 patch 里发,没太大影响的;

@codecov
Copy link

codecov bot commented Mar 10, 2017

Codecov Report

Merging #931 into master will increase coverage by 0.29%.
The diff coverage is 76.19%.

@@            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
Flag Coverage Δ
#rn 64.05% <76.19%> (+0.48%)
#web 54.59% <ø> (ø)
Impacted Files Coverage Δ
components/accordion/index.tsx 77.77% <76.19%> (+77.77%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d6ff95...9ade98e. Read the comment docs.

@silentcloud silentcloud force-pushed the rn-accordion branch 2 times, most recently from 62ff5c0 to c11dced Compare March 10, 2017 03:47
@warmhug
Copy link
Contributor

warmhug commented Mar 10, 2017

可以的。类似的, changelog 里可以不用写或者写上 “补全 accordion RN 版本”


### Accordion.Panel ( 适用平台:WEB )

| 属性 | 说明 | 类型 | 默认值 |
|------------|----------------|----------|-------------|
| key | 对应 activeKey | String | 无 |
| header | 面板头内容 | React.Element or String | 无 |

`note: RN Accordion 依赖 Icon,使用时需添加对应的 iconfont 字体`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RN还在用iconfont??

Copy link
Contributor Author

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) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这第二参数是什么?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index

Copy link
Contributor

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) {
Copy link
Contributor

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来做判断

Copy link
Contributor Author

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return null ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

恩,没问题,children 被 renderContent 处理了,其实就是个占位名

@paranoidjk paranoidjk merged commit 0d9e60b into master Mar 10, 2017
@paranoidjk paranoidjk deleted the rn-accordion branch March 10, 2017 08:28
@paranoidjk paranoidjk mentioned this pull request Mar 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants