Skip to content

Commit

Permalink
Fix shouldDisablePortalLogic in AppRootPortal
Browse files Browse the repository at this point in the history
After refactoring in c7e4c41
We inversed the logic and forgot to inverse the mode condition too.
If we want to disablePortal in fallback we should disable the portal
when the mode='full'

That issue affected Snackbar position when it is used together with
Epic and tabbar.
  • Loading branch information
mendrew committed Jan 16, 2024
1 parent c2f2079 commit 959611e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vkui/src/components/AppRoot/AppRootPortal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const AppRootPortal = ({ children, usePortal }: AppRootPortalProps) => {

const portalContainer = resolvePortalContainer(usePortal, portalRoot.current);
if (!portalContainer || shouldDisablePortal(usePortal, mode, Boolean(disablePortal))) {
return children;
return <React.Fragment>{children}</React.Fragment>;
}

return createPortal(
Expand All @@ -47,7 +47,7 @@ function shouldDisablePortal(
return disablePortal || usePortal !== true;
}
// fallback
return disablePortal || mode !== 'full';
return disablePortal || mode === 'full';
}

function resolvePortalContainer<PortalRootFromContext extends HTMLElement | null | undefined>(
Expand Down

0 comments on commit 959611e

Please sign in to comment.