Skip to content

Commit

Permalink
Merge pull request #33640 from tienifr/fix/33460
Browse files Browse the repository at this point in the history
fix: prevent double click outside RHP
  • Loading branch information
blimpich authored Jan 5, 2024
2 parents ea16996 + 3f85935 commit ae4245e
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {StackScreenProps} from '@react-navigation/stack';
import {createStackNavigator} from '@react-navigation/stack';
import React, {useMemo} from 'react';
import React, {useMemo, useRef} from 'react';
import {View} from 'react-native';
import NoDropZone from '@components/DragAndDrop/NoDropZone';
import useThemeStyles from '@hooks/useThemeStyles';
Expand All @@ -20,10 +20,21 @@ function RightModalNavigator({navigation}: RightModalNavigatorProps) {
const styles = useThemeStyles();
const {isSmallScreenWidth} = useWindowDimensions();
const screenOptions = useMemo(() => ModalNavigatorScreenOptions(styles), [styles]);
const isExecutingRef = useRef<boolean>(false);

return (
<NoDropZone>
{!isSmallScreenWidth && <Overlay onPress={navigation.goBack} />}
{!isSmallScreenWidth && (
<Overlay
onPress={() => {
if (isExecutingRef.current) {
return;
}
isExecutingRef.current = true;
navigation.goBack();
}}
/>
)}
<View style={styles.RHPNavigatorContainer(isSmallScreenWidth)}>
<Stack.Navigator screenOptions={screenOptions}>
<Stack.Screen
Expand Down

0 comments on commit ae4245e

Please sign in to comment.