Skip to content

Commit 855024f

Browse files
authored
Merge pull request #1 from bluesky-social/hailey/revert-accessibility-changes
revert gorhom#1288
2 parents 2b37e06 + 4af77ba commit 855024f

File tree

11 files changed

+27
-139
lines changed

11 files changed

+27
-139
lines changed

src/components/bottomSheet/BottomSheet.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ import {
7575
INITIAL_CONTAINER_OFFSET,
7676
INITIAL_VALUE,
7777
DEFAULT_DYNAMIC_SIZING,
78-
DEFAULT_ACCESSIBLE,
79-
DEFAULT_ACCESSIBILITY_LABEL,
80-
DEFAULT_ACCESSIBILITY_ROLE
8178
} from './constants';
8279
import type { BottomSheetMethods, Insets } from '../../types';
8380
import type { BottomSheetProps, AnimateToPositionType } from './types';
@@ -162,13 +159,6 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
162159
backgroundComponent,
163160
footerComponent,
164161
children: Content,
165-
166-
// accessibility
167-
accessible: _providedAccessible = DEFAULT_ACCESSIBLE,
168-
accessibilityLabel:
169-
_providedAccessibilityLabel = DEFAULT_ACCESSIBILITY_LABEL,
170-
accessibilityRole:
171-
_providedAccessibilityRole = DEFAULT_ACCESSIBILITY_ROLE,
172162
} = props;
173163
//#endregion
174164

@@ -1645,9 +1635,6 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
16451635
<Animated.View
16461636
pointerEvents="box-none"
16471637
style={contentMaskContainerStyle}
1648-
accessible={_providedAccessible ?? undefined}
1649-
accessibilityRole={_providedAccessibilityRole ?? undefined}
1650-
accessibilityLabel={_providedAccessibilityLabel ?? undefined}
16511638
>
16521639
<BottomSheetDraggableView
16531640
key="BottomSheetRootDraggableView"

src/components/bottomSheet/constants.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ const INITIAL_CONTAINER_OFFSET = {
3333
const INITIAL_HANDLE_HEIGHT = -999;
3434
const INITIAL_POSITION = SCREEN_HEIGHT;
3535

36-
// accessibility
37-
const DEFAULT_ACCESSIBLE = true;
38-
const DEFAULT_ACCESSIBILITY_LABEL = 'Bottom Sheet';
39-
const DEFAULT_ACCESSIBILITY_ROLE = 'adjustable';
40-
const DEFAULT_ENABLE_ACCESSIBILITY_CHANGE_ANNOUNCEMENT = true;
41-
const DEFAULT_ACCESSIBILITY_POSITION_CHANGE_ANNOUNCEMENT = (
42-
positionInScreen: string
43-
) => `Bottom sheet snapped to ${positionInScreen}% of the screen`;
44-
4536
export {
4637
DEFAULT_HANDLE_HEIGHT,
4738
DEFAULT_OVER_DRAG_RESISTANCE_FACTOR,
@@ -62,10 +53,4 @@ export {
6253
INITIAL_HANDLE_HEIGHT,
6354
INITIAL_SNAP_POINT,
6455
INITIAL_VALUE,
65-
// accessibility
66-
DEFAULT_ACCESSIBLE,
67-
DEFAULT_ACCESSIBILITY_LABEL,
68-
DEFAULT_ACCESSIBILITY_ROLE,
69-
DEFAULT_ENABLE_ACCESSIBILITY_CHANGE_ANNOUNCEMENT,
70-
DEFAULT_ACCESSIBILITY_POSITION_CHANGE_ANNOUNCEMENT,
7156
};

src/components/bottomSheet/types.d.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ import type {
1717
KEYBOARD_BLUR_BEHAVIOR,
1818
KEYBOARD_INPUT_MODE,
1919
} from '../../constants';
20-
import type {
21-
GestureEventsHandlersHookType,
22-
NullableAccessibilityProps,
23-
} from '../../types';
20+
import type { GestureEventsHandlersHookType } from '../../types';
2421

2522
export interface BottomSheetProps
2623
extends BottomSheetAnimationConfigs,
@@ -34,8 +31,7 @@ export interface BottomSheetProps
3431
| 'waitFor'
3532
| 'simultaneousHandlers'
3633
>
37-
>,
38-
Omit<NullableAccessibilityProps, 'accessibilityHint'> {
34+
> {
3935
//#region configuration
4036
/**
4137
* Initial snap point index, provide `-1` to initiate bottom sheet in closed state.

src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import React, {
2-
memo,
3-
useCallback,
4-
useEffect,
5-
useMemo,
6-
useRef,
7-
useState,
8-
} from 'react';
1+
import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
92
import { ViewProps } from 'react-native';
103
import Animated, {
114
interpolate,
@@ -26,10 +19,6 @@ import {
2619
DEFAULT_DISAPPEARS_ON_INDEX,
2720
DEFAULT_ENABLE_TOUCH_THROUGH,
2821
DEFAULT_PRESS_BEHAVIOR,
29-
DEFAULT_ACCESSIBLE,
30-
DEFAULT_ACCESSIBILITY_ROLE,
31-
DEFAULT_ACCESSIBILITY_LABEL,
32-
DEFAULT_ACCESSIBILITY_HINT,
3322
} from './constants';
3423
import { styles } from './styles';
3524
import type { BottomSheetDefaultBackdropProps } from './types';
@@ -44,10 +33,6 @@ const BottomSheetBackdropComponent = ({
4433
onPress,
4534
style,
4635
children,
47-
accessible: _providedAccessible = DEFAULT_ACCESSIBLE,
48-
accessibilityRole: _providedAccessibilityRole = DEFAULT_ACCESSIBILITY_ROLE,
49-
accessibilityLabel: _providedAccessibilityLabel = DEFAULT_ACCESSIBILITY_LABEL,
50-
accessibilityHint: _providedAccessibilityHint = DEFAULT_ACCESSIBILITY_HINT,
5136
}: BottomSheetDefaultBackdropProps) => {
5237
//#region hooks
5338
const { snapToIndex, close } = useBottomSheet();
@@ -129,42 +114,27 @@ const BottomSheetBackdropComponent = ({
129114
},
130115
[disappearsOnIndex]
131116
);
132-
133-
// addressing updating the state after unmounting.
134-
// [link](https://github.com/gorhom/react-native-bottom-sheet/issues/1376)
135-
useEffect(() => {
136-
isMounted.current = true;
137-
return () => {
138-
isMounted.current = false;
139-
};
140-
}, []);
141117
//#endregion
142118

143-
const AnimatedView = (
144-
<Animated.View
145-
style={containerStyle}
146-
pointerEvents={pointerEvents}
147-
accessible={_providedAccessible ?? undefined}
148-
accessibilityRole={_providedAccessibilityRole ?? undefined}
149-
accessibilityLabel={_providedAccessibilityLabel ?? undefined}
150-
accessibilityHint={
151-
_providedAccessibilityHint
152-
? _providedAccessibilityHint
153-
: `Tap to ${
154-
typeof pressBehavior === 'string' ? pressBehavior : 'move'
155-
} the Bottom Sheet`
156-
}
157-
>
158-
{children}
159-
</Animated.View>
160-
);
161-
162119
return pressBehavior !== 'none' ? (
163120
<TapGestureHandler onGestureEvent={gestureHandler}>
164-
{AnimatedView}
121+
<Animated.View
122+
style={containerStyle}
123+
pointerEvents={pointerEvents}
124+
accessible={true}
125+
accessibilityRole="button"
126+
accessibilityLabel="Bottom Sheet backdrop"
127+
accessibilityHint={`Tap to ${
128+
typeof pressBehavior === 'string' ? pressBehavior : 'move'
129+
} the Bottom Sheet`}
130+
>
131+
{children}
132+
</Animated.View>
165133
</TapGestureHandler>
166134
) : (
167-
AnimatedView
135+
<Animated.View pointerEvents={pointerEvents} style={containerStyle}>
136+
{children}
137+
</Animated.View>
168138
);
169139
};
170140

src/components/bottomSheetBackdrop/constants.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,10 @@ const DEFAULT_DISAPPEARS_ON_INDEX = 0;
44
const DEFAULT_ENABLE_TOUCH_THROUGH = false;
55
const DEFAULT_PRESS_BEHAVIOR = 'close' as const;
66

7-
const DEFAULT_ACCESSIBLE = true;
8-
const DEFAULT_ACCESSIBILITY_ROLE = 'button';
9-
const DEFAULT_ACCESSIBILITY_LABEL = 'Bottom sheet backdrop';
10-
const DEFAULT_ACCESSIBILITY_HINT = 'Tap to close the bottom sheet';
11-
127
export {
138
DEFAULT_OPACITY,
149
DEFAULT_APPEARS_ON_INDEX,
1510
DEFAULT_DISAPPEARS_ON_INDEX,
1611
DEFAULT_ENABLE_TOUCH_THROUGH,
1712
DEFAULT_PRESS_BEHAVIOR,
18-
DEFAULT_ACCESSIBLE,
19-
DEFAULT_ACCESSIBILITY_ROLE,
20-
DEFAULT_ACCESSIBILITY_LABEL,
21-
DEFAULT_ACCESSIBILITY_HINT,
2213
};

src/components/bottomSheetBackdrop/types.d.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { ReactNode } from 'react';
22
import type { ViewProps } from 'react-native';
3-
import type {
4-
BottomSheetVariables,
5-
NullableAccessibilityProps,
6-
} from '../../types';
3+
import type { BottomSheetVariables } from '../../types';
74

85
export interface BottomSheetBackdropProps
96
extends Pick<ViewProps, 'style'>,
@@ -12,8 +9,7 @@ export interface BottomSheetBackdropProps
129
export type BackdropPressBehavior = 'none' | 'close' | 'collapse' | number;
1310

1411
export interface BottomSheetDefaultBackdropProps
15-
extends BottomSheetBackdropProps,
16-
NullableAccessibilityProps {
12+
extends BottomSheetBackdropProps {
1713
/**
1814
* Backdrop opacity.
1915
* @type number

src/components/bottomSheetHandle/BottomSheetHandle.tsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,11 @@ import React, { memo, useMemo } from 'react';
22
import Animated from 'react-native-reanimated';
33
import { styles } from './styles';
44
import type { BottomSheetDefaultHandleProps } from './types';
5-
import {
6-
DEFAULT_ACCESSIBLE,
7-
DEFAULT_ACCESSIBILITY_ROLE,
8-
DEFAULT_ACCESSIBILITY_LABEL,
9-
DEFAULT_ACCESSIBILITY_HINT,
10-
} from './constants';
115

126
const BottomSheetHandleComponent = ({
137
style,
148
indicatorStyle: _indicatorStyle,
159
children,
16-
accessible = DEFAULT_ACCESSIBLE,
17-
accessibilityRole = DEFAULT_ACCESSIBILITY_ROLE,
18-
accessibilityLabel = DEFAULT_ACCESSIBILITY_LABEL,
19-
accessibilityHint = DEFAULT_ACCESSIBILITY_HINT,
2010
}: BottomSheetDefaultHandleProps) => {
2111
// styles
2212
const containerStyle = useMemo(
@@ -33,13 +23,7 @@ const BottomSheetHandleComponent = ({
3323

3424
// render
3525
return (
36-
<Animated.View
37-
style={containerStyle}
38-
accessible={accessible ?? undefined}
39-
accessibilityRole={accessibilityRole ?? undefined}
40-
accessibilityLabel={accessibilityLabel ?? undefined}
41-
accessibilityHint={accessibilityHint ?? undefined}
42-
>
26+
<Animated.View style={containerStyle}>
4327
<Animated.View style={indicatorStyle} />
4428
{children}
4529
</Animated.View>

src/components/bottomSheetHandle/constants.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/components/bottomSheetHandle/types.d.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
import type React from 'react';
22
import type { ViewProps } from 'react-native';
33
import type { AnimateProps } from 'react-native-reanimated';
4-
import type {
5-
BottomSheetVariables,
6-
NullableAccessibilityProps,
7-
} from '../../types';
4+
import type { BottomSheetVariables } from '../../types';
85

96
export interface BottomSheetHandleProps extends BottomSheetVariables {}
107

11-
export interface BottomSheetDefaultHandleProps
12-
extends BottomSheetHandleProps,
13-
NullableAccessibilityProps {
8+
export interface BottomSheetDefaultHandleProps extends BottomSheetHandleProps {
149
/**
1510
* View style to be applied to the handle container.
1611
* @type Animated.AnimateStyle<ViewStyle> | ViewStyle

src/components/bottomSheetHandleContainer/BottomSheetHandleContainer.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ function BottomSheetHandleContainerComponent({
9292
>
9393
<Animated.View
9494
key="BottomSheetHandleContainer"
95+
accessible={true}
96+
accessibilityRole="adjustable"
97+
accessibilityLabel="Bottom Sheet handle"
98+
accessibilityHint="Drag up or down to extend or minimize the Bottom Sheet"
9599
onLayout={handleContainerLayout}
96100
>
97101
<HandleComponent

0 commit comments

Comments
 (0)