Fix unscrollable body when returning to desktop mode from mobile mode with navigation drawer open. (#6201)

* fix: only lock body when drawer is opened and not in desktop mode

* Reuse variable

---------

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
This commit is contained in:
JustSNguyen
2024-11-12 01:33:47 +07:00
committed by GitHub
parent b85a7da26b
commit 2728de03d3
+3 -2
View File
@@ -32,8 +32,9 @@ function ShellInner() {
const navigator = useNavigation<NavigationProp>()
const closeAllActiveElements = useCloseAllActiveElements()
const {_} = useLingui()
const showDrawer = !isDesktop && isDrawerOpen
useWebBodyScrollLock(isDrawerOpen)
useWebBodyScrollLock(showDrawer)
useComposerKeyboardShortcut()
useIntentHandler()
@@ -56,7 +57,7 @@ function ShellInner() {
<Lightbox />
<PortalOutlet />
{!isDesktop && isDrawerOpen && (
{showDrawer && (
<TouchableWithoutFeedback
onPress={ev => {
// Only close if press happens outside of the drawer