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

[BUG] Custom JSX Component Breaks Animation #151

Open
oktaysenkan opened this issue Oct 24, 2024 · 4 comments · May be fixed by #152
Open

[BUG] Custom JSX Component Breaks Animation #151

oktaysenkan opened this issue Oct 24, 2024 · 4 comments · May be fixed by #152
Assignees
Labels
enhancement New feature or request

Comments

@oktaysenkan
Copy link

oktaysenkan commented Oct 24, 2024

Describe the bug
When a custom JSX component is passed to the Toast component, the animations don’t trigger properly. Specifically, the condition

if (jsx) {
  return jsx;
}

short-circuits the rest of the component, preventing any animations from running when a custom component is provided.

To Reproduce
Steps to reproduce the behavior:

  1. Create custom toast
toast.custom(
    <View
        style={{
            width: '80%',
            backgroundColor: '#26252A',
            paddingLeft: 24,
            paddingRight: 8,
            paddingVertical: 8,
            borderRadius: 999,
            flexDirection: 'row',
            alignItems: 'center',
            justifyContent: 'space-between',
            borderCurve: 'continuous',
        }}>
        <Text
            style={{
                color: '#fff',
                fontWeight: '600',
            }}>
            Custom JSX
        </Text>
        <Touchable
            style={{
                backgroundColor: '#40424B',
                borderWidth: 1,
                borderColor: '#55555C',
                borderRadius: 999,
                padding: 8,
            }}>
            <Text
                style={{
                    color: '#fff',
                    fontWeight: '600',
                }}>
                Press me
            </Text>
        </Touchable>
    </View>,
    {
        duration: 3000,
    }
)

Expected behavior
Animations should still run even when a custom JSX component is provided.

Screenshots

Screen.Recording.2024-10-24.at.10.43.17.mov

Environment info

Library Version
sonner-native ^0.15.0
react-native 0.74.5
react-native-reanimated ~3.10.1
react-native-gesture-handler ~2.16.1
@oktaysenkan oktaysenkan added the bug Something isn't working label Oct 24, 2024
@mrpmohiburrahman
Copy link

mrpmohiburrahman commented Oct 24, 2024

Hi, @gunnartorfis,
I want to work on this, if that's ok.

@gunnartorfis
Copy link
Owner

@mrpmohiburrahman PRs are always welcome.

@mrpmohiburrahman
Copy link

@mrpmohiburrahman PRs are always welcome.

I am working on it, full time.

@mrpmohiburrahman mrpmohiburrahman linked a pull request Oct 25, 2024 that will close this issue
@mrpmohiburrahman
Copy link

Hi, @gunnartorfis ,
Please, check this pr: #152

@gunnartorfis gunnartorfis added enhancement New feature or request and removed bug Something isn't working labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants