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
This commit is contained in:
parent
5eadadffbf
commit
f18b15241a
70 changed files with 634 additions and 498 deletions
|
@ -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 (
|
||||
<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue