diff --git a/src/components/bottomSheet/BottomSheet.tsx b/src/components/bottomSheet/BottomSheet.tsx index 36d676085..2897fef6f 100644 --- a/src/components/bottomSheet/BottomSheet.tsx +++ b/src/components/bottomSheet/BottomSheet.tsx @@ -76,9 +76,6 @@ import { INITIAL_CONTAINER_OFFSET, INITIAL_VALUE, DEFAULT_DYNAMIC_SIZING, - DEFAULT_ACCESSIBLE, - DEFAULT_ACCESSIBILITY_LABEL, - DEFAULT_ACCESSIBILITY_ROLE } from './constants'; import type { BottomSheetMethods, Insets } from '../../types'; import type { BottomSheetProps, AnimateToPositionType } from './types'; @@ -164,13 +161,6 @@ const BottomSheetComponent = forwardRef( backgroundComponent, renderFooter, children: Content, - - // accessibility - accessible: _providedAccessible = DEFAULT_ACCESSIBLE, - accessibilityLabel: - _providedAccessibilityLabel = DEFAULT_ACCESSIBILITY_LABEL, - accessibilityRole: - _providedAccessibilityRole = DEFAULT_ACCESSIBILITY_ROLE, } = props; //#endregion @@ -1666,9 +1656,6 @@ const BottomSheetComponent = forwardRef( `Bottom sheet snapped to ${positionInScreen}% of the screen`; - export { DEFAULT_HANDLE_HEIGHT, DEFAULT_OVER_DRAG_RESISTANCE_FACTOR, @@ -62,10 +53,4 @@ export { INITIAL_HANDLE_HEIGHT, INITIAL_SNAP_POINT, INITIAL_VALUE, - // accessibility - DEFAULT_ACCESSIBLE, - DEFAULT_ACCESSIBILITY_LABEL, - DEFAULT_ACCESSIBILITY_ROLE, - DEFAULT_ENABLE_ACCESSIBILITY_CHANGE_ANNOUNCEMENT, - DEFAULT_ACCESSIBILITY_POSITION_CHANGE_ANNOUNCEMENT, }; diff --git a/src/components/bottomSheet/types.d.ts b/src/components/bottomSheet/types.d.ts index 516497651..71c55f4d0 100644 --- a/src/components/bottomSheet/types.d.ts +++ b/src/components/bottomSheet/types.d.ts @@ -17,10 +17,7 @@ import type { KEYBOARD_BLUR_BEHAVIOR, KEYBOARD_INPUT_MODE, } from '../../constants'; -import type { - GestureEventsHandlersHookType, - NullableAccessibilityProps, -} from '../../types'; +import type { GestureEventsHandlersHookType } from '../../types'; export interface BottomSheetProps extends BottomSheetAnimationConfigs, @@ -34,8 +31,7 @@ export interface BottomSheetProps | 'waitFor' | 'simultaneousHandlers' > - >, - Omit { + > { //#region configuration /** * Initial snap point index, provide `-1` to initiate bottom sheet in closed state. diff --git a/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx b/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx index 29ea3f10f..9c6f297f5 100644 --- a/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx +++ b/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx @@ -1,12 +1,5 @@ -import React, { - memo, - useCallback, - useEffect, - useMemo, - useRef, - useState, -} from 'react'; -import type { ViewProps } from 'react-native'; +import React, { memo, useCallback, useMemo, useRef, useState } from 'react'; +import { ViewProps } from 'react-native'; import Animated, { interpolate, Extrapolate, @@ -26,10 +19,6 @@ import { DEFAULT_DISAPPEARS_ON_INDEX, DEFAULT_ENABLE_TOUCH_THROUGH, DEFAULT_PRESS_BEHAVIOR, - DEFAULT_ACCESSIBLE, - DEFAULT_ACCESSIBILITY_ROLE, - DEFAULT_ACCESSIBILITY_LABEL, - DEFAULT_ACCESSIBILITY_HINT, } from './constants'; import { styles } from './styles'; import type { BottomSheetDefaultBackdropProps } from './types'; @@ -44,10 +33,6 @@ const BottomSheetBackdropComponent = ({ onPress, style, children, - accessible: _providedAccessible = DEFAULT_ACCESSIBLE, - accessibilityRole: _providedAccessibilityRole = DEFAULT_ACCESSIBILITY_ROLE, - accessibilityLabel: _providedAccessibilityLabel = DEFAULT_ACCESSIBILITY_LABEL, - accessibilityHint: _providedAccessibilityHint = DEFAULT_ACCESSIBILITY_HINT, }: BottomSheetDefaultBackdropProps) => { //#region hooks const { snapToIndex, close } = useBottomSheet(); @@ -129,43 +114,28 @@ const BottomSheetBackdropComponent = ({ }, [disappearsOnIndex] ); - - // addressing updating the state after unmounting. - // [link](https://github.com/gorhom/react-native-bottom-sheet/issues/1376) - useEffect(() => { - isMounted.current = true; - return () => { - isMounted.current = false; - }; - }, []); //#endregion - const AnimatedView = ( - - {children} - - ); - return pressBehavior !== 'none' ? ( // @ts-ignore - {AnimatedView} + + {children} + ) : ( - AnimatedView + + {children} + ); }; diff --git a/src/components/bottomSheetBackdrop/constants.ts b/src/components/bottomSheetBackdrop/constants.ts index bf6f23dd8..c2388dbb7 100644 --- a/src/components/bottomSheetBackdrop/constants.ts +++ b/src/components/bottomSheetBackdrop/constants.ts @@ -4,19 +4,10 @@ const DEFAULT_DISAPPEARS_ON_INDEX = 0; const DEFAULT_ENABLE_TOUCH_THROUGH = false; const DEFAULT_PRESS_BEHAVIOR = 'close' as const; -const DEFAULT_ACCESSIBLE = true; -const DEFAULT_ACCESSIBILITY_ROLE = 'button'; -const DEFAULT_ACCESSIBILITY_LABEL = 'Bottom sheet backdrop'; -const DEFAULT_ACCESSIBILITY_HINT = 'Tap to close the bottom sheet'; - export { DEFAULT_OPACITY, DEFAULT_APPEARS_ON_INDEX, DEFAULT_DISAPPEARS_ON_INDEX, DEFAULT_ENABLE_TOUCH_THROUGH, DEFAULT_PRESS_BEHAVIOR, - DEFAULT_ACCESSIBLE, - DEFAULT_ACCESSIBILITY_ROLE, - DEFAULT_ACCESSIBILITY_LABEL, - DEFAULT_ACCESSIBILITY_HINT, }; diff --git a/src/components/bottomSheetBackdrop/types.d.ts b/src/components/bottomSheetBackdrop/types.d.ts index 59ea6c4c1..6a33b9a73 100644 --- a/src/components/bottomSheetBackdrop/types.d.ts +++ b/src/components/bottomSheetBackdrop/types.d.ts @@ -1,9 +1,6 @@ import { ReactNode } from 'react'; import type { ViewProps } from 'react-native'; -import type { - BottomSheetVariables, - NullableAccessibilityProps, -} from '../../types'; +import type { BottomSheetVariables } from '../../types'; export interface BottomSheetBackdropProps extends Pick, @@ -12,8 +9,7 @@ export interface BottomSheetBackdropProps export type BackdropPressBehavior = 'none' | 'close' | 'collapse' | number; export interface BottomSheetDefaultBackdropProps - extends BottomSheetBackdropProps, - NullableAccessibilityProps { + extends BottomSheetBackdropProps { /** * Backdrop opacity. * @type number diff --git a/src/components/bottomSheetHandle/BottomSheetHandle.tsx b/src/components/bottomSheetHandle/BottomSheetHandle.tsx index 1bff735d7..ea9800571 100644 --- a/src/components/bottomSheetHandle/BottomSheetHandle.tsx +++ b/src/components/bottomSheetHandle/BottomSheetHandle.tsx @@ -2,21 +2,11 @@ import React, { memo, useMemo } from 'react'; import Animated from 'react-native-reanimated'; import { styles } from './styles'; import type { BottomSheetDefaultHandleProps } from './types'; -import { - DEFAULT_ACCESSIBLE, - DEFAULT_ACCESSIBILITY_ROLE, - DEFAULT_ACCESSIBILITY_LABEL, - DEFAULT_ACCESSIBILITY_HINT, -} from './constants'; const BottomSheetHandleComponent = ({ style, indicatorStyle: _indicatorStyle, children, - accessible = DEFAULT_ACCESSIBLE, - accessibilityRole = DEFAULT_ACCESSIBILITY_ROLE, - accessibilityLabel = DEFAULT_ACCESSIBILITY_LABEL, - accessibilityHint = DEFAULT_ACCESSIBILITY_HINT, }: BottomSheetDefaultHandleProps) => { // styles const containerStyle = useMemo( @@ -33,13 +23,7 @@ const BottomSheetHandleComponent = ({ // render return ( - + {children} diff --git a/src/components/bottomSheetHandle/constants.ts b/src/components/bottomSheetHandle/constants.ts deleted file mode 100644 index 98d76c1a8..000000000 --- a/src/components/bottomSheetHandle/constants.ts +++ /dev/null @@ -1,12 +0,0 @@ -const DEFAULT_ACCESSIBLE = true; -const DEFAULT_ACCESSIBILITY_ROLE = 'adjustable'; -const DEFAULT_ACCESSIBILITY_LABEL = 'Bottom sheet handle'; -const DEFAULT_ACCESSIBILITY_HINT = - 'Drag up or down to extend or minimize the bottom sheet'; - -export { - DEFAULT_ACCESSIBLE, - DEFAULT_ACCESSIBILITY_ROLE, - DEFAULT_ACCESSIBILITY_LABEL, - DEFAULT_ACCESSIBILITY_HINT, -}; diff --git a/src/components/bottomSheetHandle/types.d.ts b/src/components/bottomSheetHandle/types.d.ts index b36cf5968..20cc2bc20 100644 --- a/src/components/bottomSheetHandle/types.d.ts +++ b/src/components/bottomSheetHandle/types.d.ts @@ -1,16 +1,11 @@ import type React from 'react'; import type { ViewProps } from 'react-native'; import type { AnimateProps } from 'react-native-reanimated'; -import type { - BottomSheetVariables, - NullableAccessibilityProps, -} from '../../types'; +import type { BottomSheetVariables } from '../../types'; export interface BottomSheetHandleProps extends BottomSheetVariables {} -export interface BottomSheetDefaultHandleProps - extends BottomSheetHandleProps, - NullableAccessibilityProps { +export interface BottomSheetDefaultHandleProps extends BottomSheetHandleProps { /** * View style to be applied to the handle container. * @type Animated.AnimateStyle | ViewStyle diff --git a/src/components/bottomSheetHandleContainer/BottomSheetHandleContainer.tsx b/src/components/bottomSheetHandleContainer/BottomSheetHandleContainer.tsx index 59f90ba92..2219e0f1d 100644 --- a/src/components/bottomSheetHandleContainer/BottomSheetHandleContainer.tsx +++ b/src/components/bottomSheetHandleContainer/BottomSheetHandleContainer.tsx @@ -92,6 +92,10 @@ function BottomSheetHandleContainerComponent({ >