[v4] Entire view being blocked by BottomSheetBackdrop
See original GitHub issueBug
The first time it works as expected, but once I move to some other screen and come back, all touch events are blocked by the backdrop overlay. Though, the backdrop component is not visible at that time.
The same app is tested on Android and iOS, but the issue is only present on the Android device.
Environment info
Library | Version |
---|---|
@gorhom/bottom-sheet | 4 |
react-native | expo: sdk-42.0.0 |
react-native-reanimated | 2.2.0 |
react-native-gesture-handler | 1.10.2 |
Device Details:
OS: Android 11 (MIUI Global 12.5.8 Stable) Model: Redmi Note 10 Pro (M2101K6P)
Steps To Reproduce
- Open the bottom sheet and close it
- Change to some other using stack navigator
- Come back to this page, touch events should be blocked.
Reproducible sample code
Its all from example code, still I’m adding the code here:
const bottomSheetRef = useRef();
const snapPoints = useMemo(() => ["80%"], []);
const renderBackdrop = useCallback(
(props) => (
<BottomSheetBackdrop
{...props}
disappearsOnIndex={-1}
appearsOnIndex={0}
enableTouchThrough={true}
/>
),
[]
);
return (
<KeyboardAvoidingView
style={styles.groceriesParentView}
behavior={Platform.OS === "ios" ? "padding" : null}>
<SafeAreaView style={styles.container}>
<BottomSheet
ref={bottomSheetRef}
index={-1}
snapPoints={snapPoints}
onChange={handleSheetChanges}
enablePanDownToClose={true}
backdropComponent={renderBackdrop}>
<View>...<View/>
</BottomSheet>
</SafeAreaView>
</KeyboardAvoidingView>
)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:9
Top Results From Across the Web
[v4] Adding index={-1} in certain devices blocks the view ...
In certain devices only : Add an index={-1} in the BottomSheet is causing the entire screen to be non-functional. It is as though...
Read more >BottomSheetBackdrop | React Native Bottom Sheet
A pre-built BottomSheet backdrop implementation with configurable props. Props. Inherits ViewProps from react-native . animatedIndex . Current sheet position ...
Read more >https://amlormusic.com/wp-content/plugins/gutenber...
Changelog == = 12.5.4 = ### Bug Fixes #### Block Library - Fix and refine core ... user experience with blocks editor when...
Read more >error warning: function components cannot be given refs ...
As the warning state you cannot assign refs to functional component without the usage the forwardRef. In order to have access to refs...
Read more >Add state changed callback to SwipeableState [164113834]
Since the bug was filed we adopted the hoisted state approach for swipeable (and many of it's users, like bottom sheet, backdrop, drawers)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Using the Custom Backdrop example (https://gorhom.github.io/react-native-bottom-sheet/custom-backdrop) I saw the same problem.
I fixed it by adding
pointerEvents="none"
to the Animated.View in the example.E.g
return <Animated.View pointerEvents="none" style={containerStyle} />;
Does this fix it for you? @Prabindas001
For those who are still struggling with this issue. As a temporary fix, it’s possible to introduce a flag and hide the backdrop component by returning null from the render function before the first opening.
The following workaround fixes the issue in Android devices with higher SDK versions, that utilize the
animatedSnapPoints
value from theuseBottomSheetDynamicSnapPoints
hook.Then add this to your BottomSheet component: