fix to prevent 'race' condition for screenDidDisappear event (#6298)

This commit is contained in:
Avinash Lingaloo 2022-05-20 19:51:36 +04:00 committed by GitHub
parent 5dba7f2667
commit 87c2adfde2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -206,7 +206,8 @@ const SnackBar = ({barType, componentId, onAction, sourceScreen}: SnackBarProps)
// This effect checks if we are navigating away and if so, it dismisses the snack bar
useEffect(() => {
const onHideSnackBar = (event?: ComponentEvent) => {
if (componentId !== event?.componentId) {
const evtComponentId = event?.componentId;
if ((componentId !== evtComponentId) && (sourceScreen !== evtComponentId)) {
animateHiding(true);
}
};