react-native-styled-toast icon indicating copy to clipboard operation
react-native-styled-toast copied to clipboard

Exported onClose function

Open durdevic opened this issue 4 years ago • 2 comments

When having a custom onPress action on the toast, would be nice to be able to call directly onClose function, instead of clicking the "close" button for it

e.g.

toast({
            duration: 4000,
            message: `Moved to ${toFolder.title}`,
            iconName: 'check',
            iconColor: 'closeIconColor',
            accentColor: 'success',
            subMessage: 'View folder',
            onPress: () => {
                    customAction()
                    onToastDismiss();
              }
        });

durdevic avatar Dec 14 '20 22:12 durdevic

Hi @durdevic, you shouldn't need to close the Toast as the onClose gets called when you trigger the onPress

jeanverster avatar Dec 17 '20 14:12 jeanverster

Hi 👋 Somehow for me it just get's minimised and persists until the duration is over.

I am navigating to another screen with react-native-navigation. Could that perhaps cause a problem?

Example:

Screen Recording 2020-12-17 at 15 45 06

durdevic avatar Dec 17 '20 14:12 durdevic