From 82b30ed2f8b2d9fb4b4d4513fb5e51090178ddb8 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 23 May 2024 19:38:48 +0800 Subject: [PATCH] set gesture direction for left modal navigator to horizontal-inverted --- .../Navigation/AppNavigator/ModalNavigatorScreenOptions.ts | 5 +++-- .../AppNavigator/Navigators/LeftModalNavigator.tsx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/ModalNavigatorScreenOptions.ts b/src/libs/Navigation/AppNavigator/ModalNavigatorScreenOptions.ts index e49a94bf4ed7..9dcbe8143b4a 100644 --- a/src/libs/Navigation/AppNavigator/ModalNavigatorScreenOptions.ts +++ b/src/libs/Navigation/AppNavigator/ModalNavigatorScreenOptions.ts @@ -1,5 +1,6 @@ import type {StackNavigationOptions} from '@react-navigation/stack'; import {CardStyleInterpolators} from '@react-navigation/stack'; +import type {GestureDirection} from '@react-navigation/stack/lib/typescript/src/types'; import type {ThemeStyles} from '@styles/index'; /** @@ -7,10 +8,10 @@ import type {ThemeStyles} from '@styles/index'; * @param themeStyles - The styles object * @returns The screen options object */ -const ModalNavigatorScreenOptions = (themeStyles: ThemeStyles): StackNavigationOptions => ({ +const ModalNavigatorScreenOptions = (themeStyles: ThemeStyles, gestureDirection: GestureDirection = 'horizontal'): StackNavigationOptions => ({ headerShown: false, animationEnabled: true, - gestureDirection: 'horizontal', + gestureDirection, cardStyle: themeStyles.navigationScreenCardStyle, cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS, }); diff --git a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx index fba323f4f60b..43241a431c32 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx @@ -21,7 +21,7 @@ const Stack = createStackNavigator(); function LeftModalNavigator({navigation}: LeftModalNavigatorProps) { const styles = useThemeStyles(); const {isSmallScreenWidth} = useWindowDimensions(); - const screenOptions = useMemo(() => ModalNavigatorScreenOptions(styles), [styles]); + const screenOptions = useMemo(() => ModalNavigatorScreenOptions(styles, 'horizontal-inverted'), [styles]); return (