diff --git a/src/hooks/useSidePanel.ts b/src/hooks/useSidePanel.ts index daa15a0e0eb4..2df4b1c5a056 100644 --- a/src/hooks/useSidePanel.ts +++ b/src/hooks/useSidePanel.ts @@ -11,7 +11,6 @@ import ONYXKEYS from '@src/ONYXKEYS'; import KeyboardUtils from '@src/utils/keyboard'; import useLocalize from './useLocalize'; import useOnyx from './useOnyx'; -import usePrevious from './usePrevious'; import useResponsiveLayout from './useResponsiveLayout'; import useWindowDimensions from './useWindowDimensions'; @@ -72,16 +71,8 @@ function useSidePanel() { const shouldApplySidePanelOffset = isExtraLargeScreenWidth && !shouldHideSidePanel; const sidePanelOffset = useRef(new Animated.Value(shouldApplySidePanelOffset ? variables.sideBarWidth : 0)); const sidePanelTranslateX = useRef(new Animated.Value(shouldHideSidePanel ? sidePanelWidth : 0)); - const prevShouldHideSidePanel = usePrevious(shouldHideSidePanel); - useEffect(() => { - if (shouldHideSidePanel && prevShouldHideSidePanel) { - sidePanelTranslateX.current.setValue(sidePanelWidth); - sidePanelOffset.current.setValue(shouldApplySidePanelOffset ? variables.sideBarWidth : 0); - return; - } setIsSidePanelTransitionEnded(false); - Animated.parallel([ Animated.timing(sidePanelOffset.current, { toValue: shouldApplySidePanelOffset ? variables.sideBarWidth : 0, @@ -94,7 +85,9 @@ function useSidePanel() { useNativeDriver: true, }), ]).start(() => setIsSidePanelTransitionEnded(true)); - }, [shouldHideSidePanel, shouldApplySidePanelOffset, sidePanelWidth, prevShouldHideSidePanel]); + + // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- sidePanelWidth dependency caused the help panel content to slide in on window resize + }, [shouldHideSidePanel, shouldApplySidePanelOffset]); const openSidePanel = useCallback(() => { setIsSidePanelTransitionEnded(false); diff --git a/src/libs/Navigation/AppNavigator/useRootNavigatorScreenOptions.ts b/src/libs/Navigation/AppNavigator/useRootNavigatorScreenOptions.ts index f6112e1f3a26..28299d7b6bea 100644 --- a/src/libs/Navigation/AppNavigator/useRootNavigatorScreenOptions.ts +++ b/src/libs/Navigation/AppNavigator/useRootNavigatorScreenOptions.ts @@ -1,6 +1,7 @@ import type {StackCardInterpolationProps} from '@react-navigation/stack'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useStyleUtils from '@hooks/useStyleUtils'; +import useThemeStyles from '@hooks/useThemeStyles'; import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation'; import Presentation from '@libs/Navigation/PlatformStackNavigation/navigationOptions/presentation'; import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types'; @@ -26,6 +27,7 @@ const useRootNavigatorScreenOptions = () => { const StyleUtils = useStyleUtils(); const modalCardStyleInterpolator = useModalCardStyleInterpolator(); const {shouldUseNarrowLayout} = useResponsiveLayout(); + const themeStyles = useThemeStyles(); return { rightModalNavigator: { @@ -79,11 +81,8 @@ const useRootNavigatorScreenOptions = () => { // We need to turn off animation for the full screen to avoid delay when closing screens. animation: Animations.NONE, web: { - cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props, isFullScreenModal: true}), - cardStyle: { - ...StyleUtils.getNavigationModalCardStyle(), - paddingLeft: shouldUseNarrowLayout ? 0 : variables.navigationTabBarSize, - }, + cardStyleInterpolator: (props: StackCardInterpolationProps) => modalCardStyleInterpolator({props, isFullScreenModal: true, shouldAnimateSidePanel: true}), + cardStyle: shouldUseNarrowLayout ? {...StyleUtils.getNavigationModalCardStyle(), paddingLeft: 0} : {...themeStyles.h100, paddingLeft: variables.navigationTabBarSize}, }, }, } satisfies RootNavigatorScreenOptions;