0
        <Button onClick={handleClick} 
                variant="contained" size="medium"
                style={{backgroundColor:"#4CB04F", color:"white" }} >
            Accept
        </Button>
      
        <Snackbar
         anchorOrigin={{
          vertical: "bottom",
          horizontal: "right",
        }}
          open={open} autoHideDuration={3000} onClose={handleClose}
        >
          <Alert
            onClose={handleClose}
            severity="success"
            
          >
            The file has been Uploaded Successfully
          </Alert>
          
        </Snackbar>
Linda Paiste
  • 38,446
  • 6
  • 64
  • 102
Kainat
  • 9
  • 2

1 Answers1

0

You are using the Snackbar component from React Native Paper. If you look at the docs here, you will notice the Snackbar already is an alert, and you should not be adding another Alert inside it.

  <Snackbar
    visible={visible}
    onDismiss={onDismissSnackBar}
    action={{
      label: 'Undo',
      onPress: () => {
        // Do something
      },
    }}>
    The file has been Uploaded Successfully
  </Snackbar>

In that same example you will find a Button component:

<Button onPress={onToggleSnackBar}>{visible ? 'Hide' : 'Show'}</Button>

This button has an onToggleSnackBar function. This is where you should check if the text area is empty or not.

p-syche
  • 575
  • 1
  • 5
  • 17