Skip to content

Commit

Permalink
Safely call getParent
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham committed Jun 4, 2024
1 parent 382d4be commit 56d4ff2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hooks/useResponsiveLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function useResponsiveLayout(): ResponsiveLayoutResult {
const currentNavigator = navigator ?? navigationContainerRef;

const isDisplayedInNarrowModalNavigator =
!!currentNavigator?.getParent(NAVIGATORS.RIGHT_MODAL_NAVIGATOR as unknown as undefined) || !!currentNavigator?.getParent(NAVIGATORS.LEFT_MODAL_NAVIGATOR as unknown as undefined);
!!currentNavigator?.getParent?.(NAVIGATORS.RIGHT_MODAL_NAVIGATOR as unknown as undefined) || !!currentNavigator?.getParent?.(NAVIGATORS.LEFT_MODAL_NAVIGATOR as unknown as undefined);

// The component calling this hook is in a "narrow pane modal" if:
const isInNarrowPaneModal =
Expand Down

0 comments on commit 56d4ff2

Please sign in to comment.