Skip to content

Commit

Permalink
Merge pull request #36927 from margelo/perunt/perf-lhn-list
Browse files Browse the repository at this point in the history
LHN list re-render
  • Loading branch information
Hayata Suenaga authored Mar 12, 2024
2 parents bca0505 + 462e200 commit 9ad7ca0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/libs/Navigation/FreezeWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {useIsFocused, useNavigation, useRoute} from '@react-navigation/native';
import React, {useEffect, useRef, useState} from 'react';
import {Freeze} from 'react-freeze';
import {InteractionManager} from 'react-native';
import type ChildrenProps from '@src/types/utils/ChildrenProps';

type FreezeWrapperProps = ChildrenProps & {
Expand Down Expand Up @@ -29,7 +28,7 @@ function FreezeWrapper({keepVisible = false, children}: FreezeWrapperProps) {
// we don't want to freeze the screen if it's the previous screen because the freeze placeholder
// would be visible at the beginning of the back animation then
if ((navigation.getState()?.index ?? 0) - (screenIndexRef.current ?? 0) > 1) {
InteractionManager.runAfterInteractions(() => setIsScreenBlurred(true));
setIsScreenBlurred(true);
} else {
setIsScreenBlurred(false);
}
Expand Down
5 changes: 1 addition & 4 deletions src/pages/home/sidebar/SidebarScreen/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import React from 'react';
import useWindowDimensions from '@hooks/useWindowDimensions';
import FreezeWrapper from '@libs/Navigation/FreezeWrapper';
import BaseSidebarScreen from './BaseSidebarScreen';
import sidebarPropTypes from './sidebarPropTypes';

function SidebarScreen(props) {
const {isSmallScreenWidth} = useWindowDimensions();

return (
<FreezeWrapper keepVisible={!isSmallScreenWidth}>
<FreezeWrapper>
<BaseSidebarScreen
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
Expand Down

0 comments on commit 9ad7ca0

Please sign in to comment.