Fix reactivity of dialogs (Dialogs Pt. 1) (#3146)
* Improve a11y on ios * Format * Remove android * Fix android * Revert some changes * use sharedvalue for `importantForAccessibility` * add back `isOpen` * fix some more types --------- Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
parent
8f623c3bdf
commit
0f9f08b1ef
4 changed files with 49 additions and 38 deletions
|
@ -30,7 +30,8 @@ import {useCloseAnyActiveElement} from '#/state/util'
|
|||
import * as notifications from 'lib/notifications/notifications'
|
||||
import {Outlet as PortalOutlet} from '#/components/Portal'
|
||||
import {MutedWordsDialog} from '#/components/dialogs/MutedWords'
|
||||
import {useDialogStateContext} from '#/state/dialogs'
|
||||
import {useDialogStateContext} from 'state/dialogs'
|
||||
import Animated from 'react-native-reanimated'
|
||||
|
||||
function ShellInner() {
|
||||
const isDrawerOpen = useIsDrawerOpen()
|
||||
|
@ -54,9 +55,9 @@ function ShellInner() {
|
|||
const canGoBack = useNavigationState(state => !isStateAtTabRoot(state))
|
||||
const {hasSession, currentAccount} = useSession()
|
||||
const closeAnyActiveElement = useCloseAnyActiveElement()
|
||||
const {importantForAccessibility} = useDialogStateContext()
|
||||
// start undefined
|
||||
const currentAccountDid = React.useRef<string | undefined>(undefined)
|
||||
const {openDialogs} = useDialogStateContext()
|
||||
|
||||
React.useEffect(() => {
|
||||
let listener = {remove() {}}
|
||||
|
@ -80,19 +81,9 @@ function ShellInner() {
|
|||
}
|
||||
}, [currentAccount])
|
||||
|
||||
/**
|
||||
* The counterpart to `accessibilityViewIsModal` for Android. This property
|
||||
* applies to the parent of all non-modal views, and prevents TalkBack from
|
||||
* navigating within content beneath an open dialog.
|
||||
*
|
||||
* @see https://reactnative.dev/docs/accessibility#importantforaccessibility-android
|
||||
*/
|
||||
const importantForAccessibility =
|
||||
openDialogs.length > 0 ? 'no-hide-descendants' : undefined
|
||||
|
||||
return (
|
||||
<>
|
||||
<View
|
||||
<Animated.View
|
||||
style={containerPadding}
|
||||
importantForAccessibility={importantForAccessibility}>
|
||||
<ErrorBoundary>
|
||||
|
@ -106,7 +97,7 @@ function ShellInner() {
|
|||
<TabsNavigator />
|
||||
</Drawer>
|
||||
</ErrorBoundary>
|
||||
</View>
|
||||
</Animated.View>
|
||||
<Composer winHeight={winDim.height} />
|
||||
<ModalsContainer />
|
||||
<MutedWordsDialog />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue