-
Notifications
You must be signed in to change notification settings - Fork 113
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
Rewrite #72
Conversation
Current coverage is 23.52% (diff: 19.14%)@@ master #72 diff @@
==========================================
Files 1 1
Lines 69 51 -18
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 8 12 +4
+ Misses 61 39 -22
Partials 0 0
|
const to = this.content.clientHeight; | ||
this.setState({action: STABLE, from: to, to}); | ||
} | ||
this.props.onRest(); |
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.
Might be better to call the callbacks without providing this
context of this.props
object, i.e.
const { onRest } = this.props;
onRest(); // no forced `this`
or
(0, this.props.onRest)(); // "global eval"
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.
Why so?
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.
Because the callbacks are not methods of this.props
object. I generally avoid calling such functions as methods because this changes semantics of what is expected inside these functions (I expect strictly no this
inside).
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.
Good point, thanks
Make state names more reasonable Simplify render() by abstracting helper functions
…ing/resizing of other elements
Good idea, done. Also renamed to be more reasonable. |
Yay! Looks like all edge-cases from issues are covered now by examples! |
Since |
I switched default branch to |
Published as |
In my current projects I have no need for Collapse yet, so I won't be able to test it "in the wild". I've reported to my teammates who needed it, maybe they will try it. |
@nkbt Please could you add a brief migration guide from 2.x to 3.x to the readme? thanks! |
@nkbt And the GIF in the readme looks like it's from the old implementation, as it mentions fixedHeight. Needs an update, too. |
The |
Yeah I definitely will add a migration guide. Scrolling is no longer in
|
Thanks!
I for some reason thought that nkbt,github.io is linked to the new branch. OK. |
Not yet, until normal release. https://npmcdn.com/react-collapse@3.0.0/build/react-collapse.js -- I need to make a codepen with it for now (or maybe several) |
re-published newer version https://npmcdn.com/react-collapse@3.1.1/build/react-collapse.js Probably better to use https://npmcdn.com/react-collapse@next/build/react-collapse.js |
Well... hmmm... full rewrite
get rid of defaultStyleactually need it for react-motionkeepCollapsedContent
option, always keep instead