I am wondering is there any way to prevent the screen reading from accessing elements that are not in the CustomDialog components while the CustomDialog is visible? I assumed react-native-paper's dialog component would take care of that but it seems that when I swipe the screen reader, it goes to the elements behind my dialog. My component looks like this:
CustomComponent.tsx
type Props = {
title: string;
body: string;
primaryAction: string;
secondaryAction: string
visible: boolean;
dismissable?: boolean;
onPrimaryAction: () => void;
onSecondaryAction: () => void;
onDismiss: () => void;
};
const CustomDialog: FunctionComponent<Props> = ({
title,
body,
primaryAction,
secondaryAction,
visible,
dismissable = true,
onPrimaryAction,
onSecondaryAction
onDismiss,
}) => {
return (
<Portal>
<Dialog style={styles.dialog} visible={visible} dismissable={dismissable} onDismiss={onDismiss}>
<Dialog.Title>
<HeaderText variant="h3">{title}</HeaderText>
</Dialog.Title>
<Dialog.Content>
<BodyText variant="b1">{body}</BodyText>
</Dialog.Content>
<Dialog.Actions>
<PrimaryButton wide style={styles.primaryAction} title={primaryAction} onPress={onPrimaryAction} />
<PrimaryButton variant="tertiary" wide title={secondaryAction} onPress={onSecondaryAction} />
</Dialog.Actions>
</Dialog>
</Portal>
);
};
export default CustomDialog;