LouisBarranqueiro / reapop

:postbox: A simple and customizable React notifications system
https://louisbarranqueiro.github.io/reapop
MIT License
1.55k stars 78 forks source link

Failed to execute 'animate' on 'Element': Partial keyframes are not supported #505

Closed NeXTs closed 2 years ago

NeXTs commented 2 years ago

Description

Several users on my site have caught these errors (tracked by sentry).

Failed to execute 'animate' on 'Element': Partial keyframes are not supported, here

on this Environment


u().animate is not a function. (In 'u().animate([{transform:l+"("+f+")",opacity:0},{transform:l+"(0)",opacity:1}],h)', 'u().animate' is undefined), here this one was minified, sorry. issue looks similar, but on iOS

on this Environment

Additional information

I was not able to reproduce them.

LouisBarranqueiro commented 2 years ago

👋 @NeXTs, Unfortunately, I won't provide a fix for this issue because these browsers are not supported. However, if you want to provide a fix and a way for me to test it, I will accept the contribution. 🙂

NeXTs commented 2 years ago

Understandable 😄

NeXTs commented 2 years ago

@LouisBarranqueiro Hello, I just realised that it's not necessary to implement animation for old browsers, it just should not crash the page. Appearing and disappearing may be instant, by setting style properties. How do you like this idea?

Example of this function

const onEnter = () => {
    const elem = getNode();
    const finalStyles = {
        transform: `${transformDirection}(0)`,
        opacity: 1
    }

    const animateSupported = "animate" in elem;
    if (!animateSupported) {
        for (const prop in finalStyles) {
            elem.style[prop] = finalStyles[prop];
        }
        return;
    }

    elem.animate(
        [
            {transform: `${transformDirection}(${transformValue})`, opacity: 0},
            finalStyles,
        ],
        animationProps
    )
}
NeXTs commented 2 years ago

ok nvm, we've customized Transition component