Skip to content
Merged
13 changes: 3 additions & 10 deletions src/hooks/useSidePanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);

@borys3kk borys3kk Jun 27, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted this code, because of bug it introduced (the content extended fully before rhp closed/jumpy animation)

Screen.Recording.2025-06-17.at.12.11.34.1.mov

sidePanelOffset.current.setValue(shouldApplySidePanelOffset ? variables.sideBarWidth : 0);
return;
}
setIsSidePanelTransitionEnded(false);

Animated.parallel([
Animated.timing(sidePanelOffset.current, {
toValue: shouldApplySidePanelOffset ? variables.sideBarWidth : 0,
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -26,6 +27,7 @@ const useRootNavigatorScreenOptions = () => {
const StyleUtils = useStyleUtils();
const modalCardStyleInterpolator = useModalCardStyleInterpolator();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const themeStyles = useThemeStyles();

return {
rightModalNavigator: {
Expand Down Expand Up @@ -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;
Expand Down
Loading