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' ;
92import { ViewProps } from 'react-native' ;
103import 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' ;
3423import { styles } from './styles' ;
3524import 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
0 commit comments