Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/components/bottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
_providedAccessibilityLabel = DEFAULT_ACCESSIBILITY_LABEL,
accessibilityRole:
_providedAccessibilityRole = DEFAULT_ACCESSIBILITY_ROLE,
accessibleBackground,
accessibilityBackgroundLabel,
accessibilityBackgroundRole,
} = props;
//#endregion

Expand Down Expand Up @@ -1852,6 +1855,9 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
{backgroundComponent === null ? null : (
<BottomSheetBackgroundContainer
key="BottomSheetBackgroundContainer"
accessible={accessibleBackground}
accessibilityLabel={accessibilityBackgroundLabel}
accessibilityRole={accessibilityBackgroundRole}
animatedIndex={animatedIndex}
animatedPosition={animatedPosition}
backgroundComponent={backgroundComponent}
Expand Down
5 changes: 4 additions & 1 deletion src/components/bottomSheet/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type React from 'react';
import type { Insets, StyleProp, View, ViewStyle } from 'react-native';
import type {AccessibilityRole, Insets, StyleProp, View, ViewStyle} from 'react-native';
import type { PanGesture } from 'react-native-gesture-handler';
import type {
AnimateStyle,
Expand Down Expand Up @@ -105,6 +105,9 @@ export interface BottomSheetProps
* @default ReduceMotion.System
*/
overrideReduceMotion?: ReduceMotion;
accessibleBackground: boolean;
accessibilityBackgroundLabel?: string;
accessibilityBackgroundRole?: AccessibilityRole;
//#endregion

//#region layout
Expand Down
14 changes: 11 additions & 3 deletions src/components/bottomSheetBackground/BottomSheetBackground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ import React, { memo } from 'react';
import { View } from 'react-native';
import { styles } from './styles';
import type { BottomSheetBackgroundProps } from './types';
import {
DEFAULT_ACCESSIBILITY_LABEL,
DEFAULT_ACCESSIBILITY_ROLE,
DEFAULT_ACCESSIBLE
} from "./constants";

const BottomSheetBackgroundComponent = ({
accessible = DEFAULT_ACCESSIBLE,
accessibilityLabel = DEFAULT_ACCESSIBILITY_LABEL,
accessibilityRole = DEFAULT_ACCESSIBILITY_ROLE,
pointerEvents,
style,
}: BottomSheetBackgroundProps) => (
<View
pointerEvents={pointerEvents}
accessible={true}
accessibilityRole="adjustable"
accessibilityLabel="Bottom Sheet"
accessible={accessible}
accessibilityRole={accessibilityRole}
accessibilityLabel={accessibilityLabel}
style={[styles.background, style]}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { styles } from './styles';
import type { BottomSheetBackgroundContainerProps } from './types';

const BottomSheetBackgroundContainerComponent = ({
accessible,
accessibilityLabel,
accessibilityRole,
animatedIndex,
animatedPosition,
backgroundComponent: _providedBackgroundComponent,
Expand All @@ -21,6 +24,9 @@ const BottomSheetBackgroundContainerComponent = ({
_providedBackgroundComponent ?? BottomSheetBackground;
return (
<BackgroundComponent
accessible={accessible}
accessibilityLabel={accessibilityLabel}
accessibilityRole={accessibilityRole}
pointerEvents="none"
animatedIndex={animatedIndex}
animatedPosition={animatedPosition}
Expand Down
11 changes: 11 additions & 0 deletions src/components/bottomSheetBackground/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// accessibility
const DEFAULT_ACCESSIBLE = true;
const DEFAULT_ACCESSIBILITY_LABEL = 'Bottom Sheet';
const DEFAULT_ACCESSIBILITY_ROLE = 'adjustable';

export {
// accessibility
DEFAULT_ACCESSIBLE,
DEFAULT_ACCESSIBILITY_LABEL,
DEFAULT_ACCESSIBILITY_ROLE,
};
2 changes: 1 addition & 1 deletion src/components/bottomSheetBackground/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ViewProps } from 'react-native';
import type { BottomSheetVariables } from '../../types';
import type { BottomSheetProps } from '../bottomSheet';
export interface BottomSheetBackgroundProps
extends Pick<ViewProps, 'pointerEvents' | 'style'>,
extends Pick<ViewProps, 'pointerEvents' | 'style' | 'accessible' | 'accessibilityLabel' | 'accessibilityRole'>,
BottomSheetVariables {}

export type BottomSheetBackgroundContainerProps = Pick<
Expand Down