TheWidlarzGroup / react-native-notificated

⚡️React Native toast notifications
https://thewidlarzgroup.github.io/react-native-notificated/
MIT License
365 stars 21 forks source link

[FEATURE] add animation config composing #150

Closed danielmark0116 closed 1 year ago

danielmark0116 commented 2 years ago

Is your feature request related to a problem? Please describe. As a developer, I want to easily pipe together different animation configs, instead of creating one complex config

Current way of generating an animation

const FadeInZoomIn = generateAnimationConfig(
    {
        config: {...}
        transitionInStyles: ()=>...
        // etc...
    }
)

Although it is fine, we end up (as library maintainers wanting to add more animations for example, or as developers wanting to create their own configs) declaring configs like SlideInZoomInFadeIn that are complex and (if in need for descriptive name) have long, hard-to-read names.

Describe the solution you'd like

Instead, what we can do is to create a separate config for each kind of transition (fading in, sliding in/out, rotating in etc) the same way as it is at the current moment, BUT allowing developers to pipe the configs, like so:

const FadeIn = generateConfig(...)
const ZoomIn = generateConfig(...)
const SlideUp = generateConfig(...)

// and then somewhere in the notifications config:
{
    animationConfig: FadeIn.add(ZoomIn).add(SlideUp)
}

TODO: