@@ -26,6 +26,7 @@ type Props = {
26
26
visible ?: boolean ;
27
27
animationDuration ?: number ;
28
28
expandable ?: boolean ;
29
+ hideable ?: boolean ;
29
30
hideOnPressOutside ?: boolean ;
30
31
overlayBackgroundColor ?: string ;
31
32
overlayOpacity ?: number ;
@@ -50,20 +51,26 @@ export const DraggablePanel = React.forwardRef<
50
51
borderRadius = 0 ,
51
52
initialHeight = DEFAULT_PANEL_HEIGHT / 2 ,
52
53
hideOnBackButtonPressed = true ,
54
+ hideable = true ,
53
55
onDismiss,
54
56
children,
55
57
} : Props ,
56
58
ref : React . Ref < ReactNativeDraggablePanelRef > ,
57
59
) => {
58
60
const [ animatedValue ] = React . useState ( new Animated . Value ( 0 ) ) ;
61
+
59
62
const [ popupVisible , togglePopupVisibility ] = React . useState ( false ) ;
63
+
60
64
const [ animating , setAnimating ] = React . useState ( false ) ;
65
+
61
66
const [ height ] = React . useState (
62
67
Math . min ( initialHeight , DEFAULT_PANEL_HEIGHT ) ,
63
68
) ;
69
+
64
70
const [ innerContentHeight , setInnerContentHeight ] = React . useState (
65
71
Math . min ( initialHeight , DEFAULT_PANEL_HEIGHT ) ,
66
72
) ;
73
+
67
74
const scrollViewRef : RefObject < ScrollView > = React . useRef ( null ) ;
68
75
69
76
React . useEffect ( ( ) => {
@@ -123,7 +130,8 @@ export const DraggablePanel = React.forwardRef<
123
130
Platform . OS === 'android' &&
124
131
hideOnBackButtonPressed &&
125
132
! animating &&
126
- popupVisible
133
+ popupVisible &&
134
+ hideable
127
135
) {
128
136
hide ( ) ;
129
137
}
@@ -213,7 +221,7 @@ export const DraggablePanel = React.forwardRef<
213
221
SCREEN_HEIGHT ,
214
222
] } >
215
223
< TouchableWithoutFeedback
216
- disabled = { ! hideOnPressOutside || animating }
224
+ disabled = { ! hideOnPressOutside || animating || ! hideable }
217
225
onPress = { hide } >
218
226
< View style = { styles . hideContainer } />
219
227
</ TouchableWithoutFeedback >
0 commit comments