Revert to old modal on android (#4458)

* revert to old modal on android

* close alf dialogs before closing composer

* Try to fix white area

* Use hook

* Fix Back button

* oops

---------

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
This commit is contained in:
Samuel Newman 2024-06-11 04:10:57 +01:00 committed by GitHub
parent 14cddb7ec0
commit d85c8a0976
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 173 additions and 147 deletions

View file

@ -169,11 +169,11 @@ const ModalContext = React.createContext<{
const ModalControlContext = React.createContext<{
openModal: (modal: Modal) => void
closeModal: () => boolean
closeAllModals: () => void
closeAllModals: () => boolean
}>({
openModal: () => {},
closeModal: () => false,
closeAllModals: () => {},
closeAllModals: () => false,
})
/**
@ -206,7 +206,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
})
const closeAllModals = useNonReactiveCallback(() => {
let wasActive = activeModals.length > 0
setActiveModals([])
return wasActive
})
unstable__openModal = openModal

View file

@ -1,9 +1,10 @@
import {useCallback} from 'react'
import {useDialogStateControlContext} from '#/state/dialogs'
import {useLightboxControls} from './lightbox'
import {useModalControls} from './modals'
import {useComposerControls} from './shell/composer'
import {useSetDrawerOpen} from './shell/drawer-open'
import {useDialogStateControlContext} from '#/state/dialogs'
/**
* returns true if something was closed
@ -22,10 +23,10 @@ export function useCloseAnyActiveElement() {
if (closeModal()) {
return true
}
if (closeComposer()) {
if (closeAllDialogs()) {
return true
}
if (closeAllDialogs()) {
if (closeComposer()) {
return true
}
setDrawerOpen(false)