fix: only close drawer if directly tapping backdrop (#3534)
This commit is contained in:
parent
cb3f246822
commit
23056daa29
1 changed files with 13 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
import React, {useEffect} from 'react'
|
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 {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useNavigation} from '@react-navigation/native'
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
@ -51,15 +51,21 @@ function ShellInner() {
|
||||||
<PortalOutlet />
|
<PortalOutlet />
|
||||||
|
|
||||||
{!isDesktop && isDrawerOpen && (
|
{!isDesktop && isDrawerOpen && (
|
||||||
<TouchableOpacity
|
<TouchableWithoutFeedback
|
||||||
onPress={() => setDrawerOpen(false)}
|
onPress={ev => {
|
||||||
style={styles.drawerMask}
|
// Only close if press happens outside of the drawer
|
||||||
|
if (ev.target === ev.currentTarget) {
|
||||||
|
setDrawerOpen(false)
|
||||||
|
}
|
||||||
|
}}
|
||||||
accessibilityLabel={_(msg`Close navigation footer`)}
|
accessibilityLabel={_(msg`Close navigation footer`)}
|
||||||
accessibilityHint={_(msg`Closes bottom navigation bar`)}>
|
accessibilityHint={_(msg`Closes bottom navigation bar`)}>
|
||||||
<View style={styles.drawerContainer}>
|
<View style={styles.drawerMask}>
|
||||||
<DrawerContent />
|
<View style={styles.drawerContainer}>
|
||||||
|
<DrawerContent />
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</TouchableWithoutFeedback>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue