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

fix(TabPane): Omit Transition when prop is false #6305

Merged
merged 3 commits into from Apr 20, 2022
Merged

fix(TabPane): Omit Transition when prop is false #6305

merged 3 commits into from Apr 20, 2022

Conversation

headdu
Copy link
Contributor

@headdu headdu commented Apr 14, 2022

While using tabs I hit a small issue:

When passing the prop transition={false} to Tabs/TabPanes the fade class was always applied thus there's always a fade animation when we change Tabs.

I was able to reproduce this using the latest version of the lib and made a codesandbox

Make sure Transition is omitted in Tabpane when prop is a boolean and false instead of falling back to Fade
@kyletsang
Copy link
Member

Thanks for the PR. I believe the issue here is that getTabTransitionComponent should actually return a different transition component rather than undefined because this ends up defaulting to Fade in the TabPane:

transition: Transition = Fade,

The change should be made here:
https://github.com/react-bootstrap/react-bootstrap/blob/master/src/getTabTransitionComponent.ts

Add

import NoopTransition from '@restart/ui/NoopTransition';

then replace line 9 with

return transition ? Fade : NoopTransition;

See if this works out

Return nooptransition from helper instead of adding logic to tabpane
@headdu
Copy link
Contributor Author

headdu commented Apr 19, 2022

Thank you for the pointers.

I did the changes you suggested and that seems to have done it as well 👍

Remove transition={false} from tabs as it is not needed
@kyletsang kyletsang merged commit 1c71e9e into react-bootstrap:master Apr 20, 2022
@kyletsang
Copy link
Member

Thanks!

@headdu headdu deleted the fix/tabpane-keeps-fade-transition branch April 21, 2022 07:40
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.

None yet

2 participants