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

Can't animate opacity when using whileHover on web #2

Closed
mathias-berg opened this issue May 27, 2022 · 3 comments
Closed

Can't animate opacity when using whileHover on web #2

mathias-berg opened this issue May 27, 2022 · 3 comments

Comments

@mathias-berg
Copy link
Contributor

mathias-berg commented May 27, 2022

There seems to be some issues with whileHover and whileTap on web.

If I just create a simple app/component looking like this:

const App = () => {
    return (
        <Motion.Pressable>
                <Motion.View
                    initial={{
                        opacity: 0,
                    }}
                    whileHover={{ opacity: 1 }} // Or whileTap={{ opacity: 1 }}
                    style={{
                        backgroundColor: '#CC22EE',
                        width: 100,
                        height: 100,
                    }}
                />
            </Motion.Pressable>
    );
}

If I have whileHover I get this error as soon as I hover over the component.

image

If I instead use whileTap, I get this error as soon as I hover (yes, hover, not clicking) over the component and it doesn't matter if it is opacity, x or scale that I try to animate, everything I try throws this error.

image

I'm using version 2.0.0.

@jmeistrich
Copy link
Contributor

This will be fixed in 2.1.0 (which adds AnimatePresence and has some performance optimizations). Can you try the pre-release 2.1.0-next.1 to fix this? I think it's ready to release but don't have time today to fully finish testing and documenting the new features.

@mathias-berg
Copy link
Contributor Author

It works with the new version!

I will test the AnimationPresence feature later tonight.

Really great library by the way!

@jmeistrich
Copy link
Contributor

Released 2.1.0 which fixes this bug.

Thanks @mathias-berg!

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

2 participants