diff options
author | Eric Bailey <git@esb.lol> | 2023-11-08 12:34:10 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-08 10:34:10 -0800 |
commit | f18b15241ab708f8c25a11937a875e361e9f1221 (patch) | |
tree | 07829ce8617cb858b4519d6f16c89c7e43f84d9c /src/view/shell/index.tsx | |
parent | 5eadadffbf5475b233da7b1463e2345ff3e3cfce (diff) | |
download | voidsky-f18b15241ab708f8c25a11937a875e361e9f1221.tar.zst |
Add modal state provider, replace usage except methods (#1833)
* Add modal state provider, replace usage except methods * Replace easy spots * Fix sticky spots * Replace final usages * Memorize context objects * Add more warnings
Diffstat (limited to 'src/view/shell/index.tsx')
-rw-r--r-- | src/view/shell/index.tsx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/view/shell/index.tsx b/src/view/shell/index.tsx index 703edf27a..498bc11bd 100644 --- a/src/view/shell/index.tsx +++ b/src/view/shell/index.tsx @@ -32,12 +32,14 @@ import { useIsDrawerSwipeDisabled, } from '#/state/shell' import {isAndroid} from 'platform/detection' +import {useModalControls} from '#/state/modals' const ShellInner = observer(function ShellInnerImpl() { const store = useStores() const isDrawerOpen = useIsDrawerOpen() const isDrawerSwipeDisabled = useIsDrawerSwipeDisabled() const setIsDrawerOpen = useSetDrawerOpen() + const {closeModal} = useModalControls() useOTAUpdate() // this hook polls for OTA updates every few seconds const winDim = useWindowDimensions() const safeAreaInsets = useSafeAreaInsets() @@ -60,13 +62,14 @@ const ShellInner = observer(function ShellInnerImpl() { if (isAndroid) { listener = BackHandler.addEventListener('hardwareBackPress', () => { setIsDrawerOpen(false) + closeModal() return store.shell.closeAnyActiveElement() }) } return () => { listener.remove() } - }, [store, setIsDrawerOpen]) + }, [store, setIsDrawerOpen, closeModal]) return ( <> |