rnheroes / react-native-toastable

🍞 Blazingly fast and fully customizable Toaster component for React Native
https://www.npmjs.com/package/react-native-toastable
MIT License
91 stars 4 forks source link

How to autohide the Toast. #2

Closed HimanshuCF closed 1 year ago

HimanshuCF commented 1 year ago

Hey really loved the library and its simplicity. I was just wondering how to autohide the toast after few seconds.



showToastable({ message: 'react-native-heroes', alwaysVisible: true, animationInTiming: 1000, animationOutTiming: 1000, backgroundColor: 'red', duration: 2000, contentStyle: { marginHorizontal: 20, }, onPress: () => { console.log('onPress'); }, status: 'success', swipeDirection: 'left', })

        <Toastable
              containerStyle={{ marginHorizontal: 20 }}
              alwaysVisible
              animationInTiming={2000}
              animationOutTiming={2000}
              duration={5000}
              onToastableHide={() => {
                console.log('onToastableHide');
              }}
              statusMap={{
                success: 'green',
                danger: 'red',
                info: 'blue',
                warning: 'yellow',
              }}
              renderContent={(props) => <ToastableBody {...props} />}
              swipeDirection={['left', 'right']}
            />
enestatli commented 1 year ago

@HimanshuCF Hello, thanks. If you remove alwaysVisible param it will hide automatically based on duration