Skip to content

Commit

Permalink
fix: only close drawer if directly tapping backdrop (#3534)
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-ext authored Apr 14, 2024
1 parent cb3f246 commit 23056da
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/view/shell/index.web.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useEffect} from 'react'
import {StyleSheet, TouchableOpacity, View} from 'react-native'
import {StyleSheet, TouchableWithoutFeedback, View} from 'react-native'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useNavigation} from '@react-navigation/native'
Expand Down Expand Up @@ -51,15 +51,21 @@ function ShellInner() {
<PortalOutlet />

{!isDesktop && isDrawerOpen && (
<TouchableOpacity
onPress={() => setDrawerOpen(false)}
style={styles.drawerMask}
<TouchableWithoutFeedback
onPress={ev => {
// Only close if press happens outside of the drawer
if (ev.target === ev.currentTarget) {
setDrawerOpen(false)
}
}}
accessibilityLabel={_(msg`Close navigation footer`)}
accessibilityHint={_(msg`Closes bottom navigation bar`)}>
<View style={styles.drawerContainer}>
<DrawerContent />
<View style={styles.drawerMask}>
<View style={styles.drawerContainer}>
<DrawerContent />
</View>
</View>
</TouchableOpacity>
</TouchableWithoutFeedback>
)}
</>
)
Expand Down

0 comments on commit 23056da

Please sign in to comment.