0
import { Snackbar } from 'react-native-paper'

<Snackbar
     visible={visible}
     onDismiss={handleDismiss}
     action={{
       label: 'hide',
       onPress: handleDismiss,
     }}
     duration={Snackbar.DURATION_SHORT}
     style={styles.snackText}
   >
     {text}
</Snackbar>

Once after the Snackbar appears, if screen navigation is continuously done, the Snackbar is not getting hidden after the specified duration value. I think the duration is getting reset to its initial value if screen navigation is made. If I stop navigation and stay idle for the specified duration value, then only the Snackbar is closing.

  • you can set the value of visible to false before navigating to some other screen. – this.arjun Mar 11 '22 at 18:04
  • Thanks for the answer @this.arjun .I am using a re-usable Snackbar component through out the app. There are a lot of screens and I don't think it is a good thing to have closeSnackbar call on every Navigation call. Moreover, I need to update all the lines where the navigation is being called. – Anurag Mantripragada Mar 11 '22 at 19:48

0 Answers0