Skip to content

Commit 2c04548

Browse files
update docs
1 parent 5fe71a5 commit 2c04548

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

contributingGuides/NAVIGATION.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ function useCustomRootStackNavigatorState({state}: CustomStateHookProps) {
654654
}
655655
```
656656

657-
To optimize the number of routes rendered in `RootStackNavigator` we limit the number of `FullScreenNavigators` rendered to 2 (we need to render the previous fullscreen too for the transition animations to work well).
657+
To optimize the number of routes rendered in `RootStackNavigator` we limit the number of `FullScreenNavigators` rendered to 2 (we need to render the previous fullscreen too for the transition animations to work well). There's an exception for `SearchFullscreenNavigator` where we render only last route when possible due to performance implications. The idea stays the same.
658658

659659
- `src/libs/Navigation/AppNavigator/createSearchFullscreenNavigator/index.tsx`
660660

@@ -664,10 +664,9 @@ function useCustomEffects(props: CustomEffectsHookProps) {
664664
usePreserveNavigatorState(props.state, props.parentRoute);
665665
}
666666
667-
// This is a custom state hook that is used to render the last two routes in the stack.
668-
// We do this to improve the performance of the search results screen.
669-
function useCustomState({state}: CustomStateHookProps) {
670-
const routesToRender = [...state.routes.slice(-2)];
667+
// For web we only render last route in SearchFullscreenNavigator. Other navigators are keep last two routes mounted. The idea stays the same.
668+
export default function useCustomState({state}: CustomStateHookProps) {
669+
const routesToRender = state.routes.slice(-1);
671670
return {...state, routes: routesToRender, index: routesToRender.length - 1};
672671
}
673672
```

0 commit comments

Comments
 (0)