Skip to content

Commit

Permalink
Add comments to useNavigationResetOnLayoutChange hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Dec 4, 2024
1 parent 1c83a60 commit 5b46385
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import navigationRef from '@libs/Navigation/navigationRef';
import type {CustomEffectsHookProps} from '@libs/Navigation/PlatformStackNavigation/types';

/**
* This hook resets the navigation root state when changing the layout size, resetting the state calls the getRehydredState method in CustomFullScreenRouter.tsx.
* When the screen size is changed, it is necessary to check whether the application displays the content correctly.
* When the app is opened on a small layout and the user resizes it to wide, a second screen has to be present in the navigation state to fill the space.
*/
function useNavigationResetOnLayoutChange({navigation}: CustomEffectsHookProps<ParamListBase>) {
const {shouldUseNarrowLayout} = useResponsiveLayout();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import {useEffect} from 'react';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import navigationRef from '@libs/Navigation/navigationRef';

/**
* This hook resets the navigation root state when changing the layout size, resetting the state calls the getRehydredState method in CustomRouter.ts.
* When the screen size is changed, it is necessary to check whether the application displays the content correctly.
* When the app is opened on a small layout and the user resizes it to wide, a second screen has to be present in the navigation state to fill the space.
*/
function useNavigationResetRootOnLayoutChange() {
const {shouldUseNarrowLayout} = useResponsiveLayout();

Expand Down

0 comments on commit 5b46385

Please sign in to comment.