You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-03 23:50:33 +02:00
28 lines
882 B
TypeScript
28 lines
882 B
TypeScript
![]() |
import * as React from 'react';
|
||
|
import AccessibleView from '../AccessibleView';
|
||
|
import { FocusControlContext } from './FocusControlProvider';
|
||
|
import { useContext } from 'react';
|
||
|
import { StyleProp, ViewStyle } from 'react-native';
|
||
|
import AutoFocusProvider from './AutoFocusProvider';
|
||
|
|
||
|
interface Props {
|
||
|
children: React.ReactNode;
|
||
|
style?: StyleProp<ViewStyle>;
|
||
|
}
|
||
|
|
||
|
// A region that should not be accessibility focusable while a dialog
|
||
|
// is open.
|
||
|
const MainAppContent: React.FC<Props> = props => {
|
||
|
const { hasOpenModal, hasClosingModal } = useContext(FocusControlContext);
|
||
|
const blockFocus = hasOpenModal;
|
||
|
const allowAutoFocus = !hasClosingModal && !blockFocus;
|
||
|
|
||
|
return <AccessibleView inert={blockFocus} style={props.style}>
|
||
|
<AutoFocusProvider allowAutoFocus={allowAutoFocus}>
|
||
|
{props.children}
|
||
|
</AutoFocusProvider>
|
||
|
</AccessibleView>;
|
||
|
};
|
||
|
|
||
|
export default MainAppContent;
|