Skip to content

Update react transition group (WIP)#557

Merged
TheSharpieOne merged 47 commits intoreactstrap:v5from
amikhalev:update-react-transition-group
Sep 16, 2017
Merged

Update react transition group (WIP)#557
TheSharpieOne merged 47 commits intoreactstrap:v5from
amikhalev:update-react-transition-group

Conversation

@amikhalev
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Collaborator

@virgofx virgofx left a comment

Choose a reason for hiding this comment

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

Looks good and simplied much of the code. I think if we just had more clear cut documentation on the default timeouts and if changing them, what variables need to be set that would be my only suggestion.

Comment thread src/Fade.js Outdated
transitionEnter: true,
transitionLeave: true
baseClassActive: 'show',
timeout: 150,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It appears bootstrap default is 300ms

https://github.com/twbs/bootstrap/blob/v4-dev/scss/_variables.scss#L688

We should definitely comment this (briefly here and more thoroughly in the example/documentation) as the timeout here also requires updating $modal-transition in custom bootstrap builds as this is important for syncing the CSS UI with the timeouts here.

EDIT: I apologize. I referenced the Modal timeouts against the Fade here. Bootstrap's Fade components are all 150 so this is correct. The modal is separate which uses 300ms/150ms. Could we at least add documentation in both these locations in source and in documentation examples as its real important that these sync otherwise there will be huge jumps where the transition end timeouts prior or the CSS transition is still continuing.

  • Modal timeout changes need to update: $modal-transition
  • Fade component changes (e.g. Alert) need to update: $transition-fade

@amikhalev
Copy link
Copy Markdown
Contributor Author

@TheSharpieOne

I think this is almost done. Only Carousel doesn't work ATM. I do have a few questions

  1. I kinda forgot to do conventional commits, so would you like me to go back and edit each commit message? Or I could squash this into 1 or several commits with better messages.

  2. Should I add a doc page for the Fade component? Or is this considered an internal component

  3. Any other changes that need to be made to this code?

@TheSharpieOne
Copy link
Copy Markdown
Member

@amikhalev Thanks a ton for tackling this.

  1. I can (and will) squash when I merge the commit and change the commit message to use a conventional message
  2. I would say yes, create a doc page, but if you don't, it probably isn't that big of a deal (like tether is)
    • The transition prop names exposed for Alert vs Modal and CarouselItem. It would be nice to have them all be consistent.
    • Make all of the transition props overridable (there are a few which are not)
    • Allow timeout to an object or an integer much like Transition allows (kinda goes with consitent prop names b/c Alert has two timeout props)
    • Speaking of the Fade component, would it be possible to use Fade with Alert rather than having it's own within the component?
    • When checking the status of the transition, can you use the variables exposed by Transition ?import Transition, { EXITED, ENTERED, ENTERING, EXITING } from 'react-transition-group/Transition';
    • What is going on with Carousel? (do you plan on resolving it in thie PR or should this be merged and Carousel be addressed in a later effort?)
    • I'll add more comment inline

Comment thread src/CarouselItem.js Outdated
{children}
</div>
<Transition
in={true}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we want expose Transition props and spread them here? If so, can you also check for the existance of a user provided onExited and onExiting (via props) and call them in your callbacks (to not clobber the user's callbacks)

Comment thread src/CarouselItem.js Outdated
>
{(status) => {
const { direction } = this.context;
console.log("altText: ", altText, ", status: ", status, ", direction: ", direction);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Extra log statement here

@mkalish
Copy link
Copy Markdown
Contributor

mkalish commented Aug 31, 2017

@amikhalev
I'm happy to take a look at updating the carousel code over the weekend if you want to get this merged

@amikhalev
Copy link
Copy Markdown
Contributor Author

@virgofx Ok, I wasn't aware that individual imports was preferred

@amikhalev
Copy link
Copy Markdown
Contributor Author

@mkalish @TheSharpieOne I should be able to fix Carousel (and the rest of your issues), I just made some temp commits for now. I'll probably get it done some time this weekend

@virgofx
Copy link
Copy Markdown
Collaborator

virgofx commented Aug 31, 2017

@amikhalev Thanks. :)

@TheSharpieOne
Copy link
Copy Markdown
Member

@amikhalev I don't want to mess with your flow, but I have some large commits ready to be merged into v5 (such as the popper branch). I had to update react-scripts which updated eslint and jest which changed the test API (the jest 19/20 stuff) and eslint rules. Everything is working in the popper branch and test coverage have been improved (back to 99.66%), but I had to touch lots of test files, including ones you have touched. I also had to fix new linter issues which touched some of the code you have touched.
I'm not sure the best course of action, if you want me to merge my stuff in and you rebase / pull and deal with what conflicts may happen (since you will be more familiar with those files as the major changes are in your branch), update tests which may need to use the new jest stuff, as well as fix linter issues which may arise. Or I can wait to merge my code until you are done and I can deal with the conflicts (most likely keeping your changing and just fixing anything that breaks).

@amikhalev
Copy link
Copy Markdown
Contributor Author

@TheSharpieOne Go ahead and merge the updates, I can deal with any merge conflicts

@amikhalev
Copy link
Copy Markdown
Contributor Author

@virgofx It doesn't look like there's a way to access the constants defined here without importing "react-transition-group/Transition". Would you say it is OK to do so in this case?

@amikhalev
Copy link
Copy Markdown
Contributor Author

amikhalev commented Sep 2, 2017

@TheSharpieOne

I think I fixed most of your issues. Carousel works now (:tada:), Alert, Carousel and Modal all expose their transition props, Alert uses Fade, and everything uses constants from react-transition-group

Here are the issues that I think I still need to address

  • There is some kind of issue with Modal which prevents it from dismissing properly
  • If you click the control button or keyboard button too quickly with Carousel, the transition breaks and it shows multiple slides stacked vertically
  • Lots of documentation is out of sync (mostly for Carousel)
  • Lots of tests are broken (might wait to fix this one until new testing stuff is merged)
  • Probably should write more/better tests for Fade, Carousel (esp. slide prop)
  • I think that since Fade is used by both Alert and Modal, plus it could be used by users of reactstrap for fading arbitrary components, it should probably get it's own documentation page explaining it's props in more detail

@amikhalev amikhalev force-pushed the update-react-transition-group branch from 1a67cbf to 12937d2 Compare September 3, 2017 18:09
@amikhalev
Copy link
Copy Markdown
Contributor Author

@TheSharpieOne It looks like Collapse could be made to use Transition. Should I pass it's existing props to Transition or just update them to match?

@virgofx
Copy link
Copy Markdown
Collaborator

virgofx commented Sep 4, 2017

I was thinking the same thing. I believe we could just wrap around Transition and the Collapse component itself should be much smaller code-wise as we should re-use much of the transition logic/props, etc. So the closer we can keep inline with transition would be my vote.

@amikhalev
Copy link
Copy Markdown
Contributor Author

In that case, what should I name props?
in or isOpen?
onOpened or onEntered?
onClosed or onExited?
Should they be consistent between Alert, Fade, CarouselItem, Collapse and Modal? Or maybe more than one should be supported for each component. I'm not sure what's best here

@TheSharpieOne
Copy link
Copy Markdown
Member

I think we should probably keep isOpen, even though in is more generic. In the few cases where isOpen doesn't make any sense, I'm fine with using in there (even if it isn't 100% consistent). For the callbacks, I would prefer the same names as the transition component.

@amikhalev amikhalev force-pushed the update-react-transition-group branch from 76948b2 to 21413f5 Compare September 11, 2017 22:41
@holgersindbaek
Copy link
Copy Markdown

When is this branch getting merged? I'm getting a lot of issues with react-transition-group.

@carlschubert
Copy link
Copy Markdown

I've also been watching this thread. I've been holding off on a few things waiting for react-transition-group to be updated. It would be nice to know the timeline.

@amikhalev
Copy link
Copy Markdown
Contributor Author

All of the code is done. The only thing that it needs is updated tests (a lot of which is just removing tests because the code was simplified a lot). I'll probably get it done later today

@amikhalev
Copy link
Copy Markdown
Contributor Author

Ok, looks like all tests pass now. I'm pretty sure all docs are updated too. I think this is ready for final review

Copy link
Copy Markdown
Member

@TheSharpieOne TheSharpieOne left a comment

Choose a reason for hiding this comment

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

Docs could use some work, but I don't know how much the existing docs fit into the WIP docs eddywashere is working on. Other than that there are just a few things which can be addressed after it's merge (I'll make the tweaks).

Comment thread src/Collapse.js
return delay;
onExiting(node) {
// getting this variable triggers a reflow
const _unused = node.offsetHeight; // eslint-disable-line no-unused-vars
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if the minifier will remove this or not

Comment thread src/Collapse.js
}, this.getDelay('hide'));
}
// else: do nothing.
['onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited'].forEach((name) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Interesting. Maybe CarouselItem could do the same.

@TheSharpieOne TheSharpieOne merged commit e8737a5 into reactstrap:v5 Sep 16, 2017
@TheSharpieOne
Copy link
Copy Markdown
Member

Awesome job @amikhalev. Thanks a ton!

@amikhalev
Copy link
Copy Markdown
Contributor Author

Thanks! It was my pleasure. reactstrap is a great library, glad to contribute!

@holgersindbaek
Copy link
Copy Markdown

Nice. Thanks.

virgofx pushed a commit to virgofx/reactstrap that referenced this pull request Sep 29, 2017
* Updated rollup and webpack configs

Removed global 'react-transition-group' from both rollup and webpack configs

* Updated Alert for [email protected]

Also updated props related to transitions in order to better match updated react-transition-group props

* Updated AlertPage.js docs for new transition props

* Fixed Alert tests for new transition props

* Fixed lint issues related to Alert changes

* Almost fixed Fade and Modal to work with [email protected]

* Fixed Modal exit transition

* Fixed lint issues

* Fixed Fade test

* Fixed Modal test; removed use of setImmediate

* Fixed Modal.spec.js formatting

* Updated install docs to remove react-transition-group

* Updated modal documentation

* Almost got carousel to work

* Fixed fade props passing

* Changed the way Carousel works; still not quite fixed

* More attempts at fixing Carousel

* Changed Alert to use Fade

* Fixed all react-transition-group imports to not cherry pick

* Now modal is broken :/ Fixing this

* Some mork work

* Changed Transition uses to use constants instead of strings

* Made Carousel work! Plus added Carousel slide prop

* Minor change to Fade test

* Removed debug logging from CarouselItem

* Fixed Modal and siplified logic

* Extracted transition timeouts to utils

* Simplified CarouselItem transition logic

* Removed unnecessary noop props (they exist in Transition.defaultProps)

* Removed CarouselItem status field

* Added docs for Fade

This meant adding  FadePage, plus adding to routes and navigation. I also updated prism to add the autolinker plugin to enable links in the docs for proptypes

* Updated Alert and Modal docs to point to Fade docs

* Added mountOnEnter for Modal backdrop

* Updated carousel proptypes doc

* Fixed eslint issues

* Updated Collapse to use Transition

* Removed confusing callbacks from Modal. The callbacks on modalTransition can be used instead

* Updated react-transition-group in package.json

* Fixed collapse tests

* Fixed eslint issues

* Fixed Collapse callback issue, updated test, updated examples

* Updated Collapse Docs

* Added some Alert tests

* Updated Collapse and Collapse tests

* Updated Carousel tests

* Updated Fade tests

* Fixed modal tests
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.

6 participants