File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
packages/drawer/src/views Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -575,6 +575,7 @@ export default class DrawerView extends React.Component<DrawerProps> {
575575 // Disable overlay if sidebar is permanent
576576 drawerType === 'permanent' ? null : (
577577 < Overlay
578+ pointerEvents = { isOpen ? 'auto' : 'none' }
578579 progress = { progress }
579580 onPress = { ( ) => this . toggleDrawer ( false ) }
580581 style = { overlayStyle as any }
Original file line number Diff line number Diff line change 11import * as React from 'react' ;
22import { Platform , Pressable , StyleSheet } from 'react-native' ;
3- import Animated , { useAnimatedStyle } from 'react-native-reanimated' ;
3+ import Animated , {
4+ useAnimatedProps ,
5+ useAnimatedStyle ,
6+ } from 'react-native-reanimated' ;
47
58const PROGRESS_EPSILON = 0.05 ;
69
@@ -17,17 +20,23 @@ const Overlay = React.forwardRef(function Overlay(
1720 return {
1821 opacity : progress . value ,
1922 // We don't want the user to be able to press through the overlay when drawer is open
20- // One approach is to adjust the pointerEvents based on the progress
21- // But we can also send the overlay behind the screen
23+ // We can send the overlay behind the screen to avoid it
2224 zIndex : progress . value > PROGRESS_EPSILON ? 0 : - 1 ,
2325 } ;
2426 } ) ;
2527
28+ const animatedProps = useAnimatedProps ( ( ) => {
29+ return {
30+ pointerEvents : progress . value > PROGRESS_EPSILON ? 'auto' : 'none' ,
31+ } as const ;
32+ } ) ;
33+
2634 return (
2735 < Animated . View
2836 { ...props }
2937 ref = { ref }
3038 style = { [ styles . overlay , overlayStyle , animatedStyle , style ] }
39+ animatedProps = { animatedProps }
3140 >
3241 < Pressable onPress = { onPress } style = { styles . pressable } />
3342 </ Animated . View >
You can’t perform that action at this time.
0 commit comments