backdrop is not removing when I close the sheet
Bug
I have given containerStyle to bottom sheet but when I close the sheet container is not closing, the style is still there.
<BottomSheet
ref={bottomSheetRef}
index={-1}
snapPoints={snapPoints}
containerStyle={{
backgroundColor:'rgba(0,0,0,0.3)'
}}
handleIndicatorStyle={{
width: 100,
}}
>
when I close sheet container is removing.


Environment info
| Library | Version |
|---|---|
| @gorhom/bottom-sheet | 4.4.5 |
| react-native | 0.69.4 |
| react-native-reanimated | 2.10.0 |
| react-native-gesture-handler | 2.6.1 |
Steps To Reproduce
Describe what you expected to happen:
- don't want container when sheet is closed
Reproducible sample code
@RutvinBhanderi: hello! :wave:
This issue is being automatically closed because it does not follow the issue template.
i have the same problem, and i dont know if its a bug or something that im doing wrong
Add the BottomSheetBackdrop imported from @gorhom/bottom-sheet and pass dissappearsOnIndex={-1}
<BottomSheet
ref={ref}
index={-1}
enablePanDownToClose
**backdropComponent={(backdropProps) => <BottomSheetBackdrop {...backdropProps} disappearsOnIndex={-1} />}**
backgroundStyle={{ backgroundColor: theme.colors.background }}
handleIndicatorStyle={{ backgroundColor: theme.colors.text }}
>
@Cosmind0 We have imported the backdrop from the library and have added disappearsOnIndex as well but it still fails with Reanimated v3 and more. Can you please help? @gorhom
@RutvinBhanderi Did u find the solution?
@Cosmind0 We have imported the backdrop from the library and have added disappearsOnIndex as well but it still fails with Reanimated v3 and more. Can you please help? @gorhom
@RutvinBhanderi Did u find the solution?
You can create custom backdrop like this and it worked for me import { BottomSheetBackdrop, } from "@gorhom/bottom-sheet"; import React from "react";
const CustomBackdrop = (props) => { return ( <BottomSheetBackdrop {...props} pressBehavior="none" disappearsOnIndex={-1} appearsOnIndex={0} enableTouchThrough={false} opacity={0.4} /> ); }; export default CustomBackdrop;
@malikzype And I'm pretty sure that you don't need to add the background to the containerStyle, you need to do it like this backgroundStyle={{ backgroundColor: 'rgba(0,0,0,0.3)'}}. Not sure though, I haven't tried to do it with containerStyle
@Cosmind0 @RutvinBhanderi We have created our custom backdrop component. It works fine with Reanimated version >3. In version 3 of reanimated the keyboard calls on the onClose method of the bottom sheet and in some scenarios, it leaves the backdrop component as is which creates the issue.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
this issues still persist.