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

Add a class when component is appearing / disappearing #45

Open
floo51 opened this issue May 23, 2017 · 4 comments
Open

Add a class when component is appearing / disappearing #45

floo51 opened this issue May 23, 2017 · 4 comments

Comments

@floo51
Copy link

floo51 commented May 23, 2017

I'm going for a full material design app and I'd like to implement more transitions inside the views when they appear or disappear.
Something like this, with the ❤️ icon appearing while the whole view is transitionning, taken from official guidelines, § Motion is clear*

I think that just adding a enter and leave class to the component whenever a transition starts would be enough.

Can you think of any other way ? Would you accept a PR on this ?

@maisano
Copy link
Owner

maisano commented Jun 15, 2017

hi @floo51! this is a neat idea, though i fear opening up/leaking the abstraction outside of the current constraints may be harmful in the longterm. i am not entirely opposed to the idea, though i wonder if there is a workaround given the current api. can you think of any other alternatives than affixing a new class name?

@floo51
Copy link
Author

floo51 commented Jun 15, 2017

Hmm we could try building a HOC so we could wrap components like:

import React from 'react';
import { withTransitionState } from 'react-router-transition';

const MyComponent = ({transitionState}) => (
    <div className={transitionState === 'mounting' ? 'whatever': 'something else'}></div>
);

export withTransitionState(MyComponent);

It gives control over what we wanna do when transitioning, wether we want to add a class or do something else.
Not sure how feasible it is but I think it would be the best API, I can throw a PR in the week-end if needed !

@joneldiablo
Copy link

its there a way to set className to the wrapper, only when transition is runing?

@Lathryx
Copy link

Lathryx commented Mar 18, 2021

I am also having this problem.

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

No branches or pull requests

4 participants